Question

It seems to be a Django best practice to add the settings.py file to the ignore list of the version control system. But how does one start to set up a project when the settings.py file was not included in the (Github) project*?

Starting from a default settings file is not at all easy because I have no experience with Django, and see that there are an specific settings for included modules/frameworks that need to be included.

Is there a way to create a settings.py file from the code in an existing Django project? Is there any other alternative to trial and error if the author cannot be contacted or is not responding to the request for an example file?

Était-ce utile?

La solution

In fact is not a best practice to put it on the ignore list based on the opinion of Daniel Greenfeld (AKA Pydany) and Audrey Roy on "Two Scoops of Django". In fact is recommended that you keep one setting file for every setup your team members have.

Of course the easiest way to proceed is to contact the author and if he is that kind you can get it.

I would recommend the following:

  1. Take a default settings.py from an new project
  2. Locate the requirements.txt and verify which one of the apps located there are django base and include them to the settings.py
  3. Include all the apps explicitly defined on the project (all the folders different to the appname folder)
  4. After that is just trial en error( or more like trial and exception).
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top