开发者

How to work with settings in Django

开发者 https://www.devze.com 2023-01-16 14:49 出处:网络
I want to keep some global settings for my project in Django. I need to have access to these settings from the code. For example, I need to set a current theme for my site that I can set using admin c

I want to keep some global settings for my project in Django. I need to have access to these settings from the code. For example, I need to set a current theme for my site that I can set using admin console or from the code. Or I n开发者_JAVA技巧eed to set a tagline that will show in the header of all pages. I suppose I should use models for keeping the settings but I can't realize how I should better do it.


There are quite some packages that store settings in models, pick the one that works best for you:

http://pypi.python.org/pypi?:action=search&term=django+settings&submit=search


If you are okay with changing these setting programmatically via settings.py you should do that. However, if you want to change these settings via the Admin Console, you should use models.

0

精彩评论

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