开发者

Difference Between Satchmo's local_settings.py and settings.py

Can someone explain the difference between local_settings.py and settings.py in Satchmo?

I understand that the settings.py module imports the local_settings.py module as it's final step. So any settings in local_settings.py takes precedence. But what is the point of doing this? Isn't settings.py supposed to be the configuration which is specific to your project anyway? Why bother with the additional s开发者_JAVA技巧tep of having local_settings.py?

Basically I find myself needing to add new settings and I can't figure out if I should put them in settings.py or local_settings.py. Can someone shine some light on this?


The local_settings.py is only for on your local development system where it extends settings.py. On your deployment server, settings.py is used only without local_settings.py.

One recommendation is that local_settings.py is not included in your repository, so that each developer can have their own and so that it is not used on the deployment server.

Checkout these articles for more information:

  1. Extending Django settings.py File
  2. Extending Settings Variables with local_settings.py in Django
  3. Django settings.py for development and production
  4. A Different Approach to local_settings.py


The idea is that settings.py contains all the settings you actually need to run your project. local_settings.py is for if you need to override any of them locally, for instance in development. For example, you might have different database passwords, or template paths, etc.

The answer to your question is to put new settings into settings.py, though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜