How do I use different setting for each application?
如何为每个应用程序使用不同的设置?
For example:
例如:
-
http://www.mysite.com/app1 uses the settings.py + local_settings.py of the app1's folder...
http://www.mysite.com/app1使用的设置。py + local_settings。app1文件夹的py…
-
http://www.mysite.com/app2 uses the settings.py + local_settings.py of the app2's folder...
http://www.mysite.com/app2使用的设置。py + local_settings。app2文件夹的py…
etc...
等等……
Thanks,
谢谢,
3 个解决方案
#1
2
you could check all ways of splitting up your settings from here: https://code.djangoproject.com/wiki/SplitSettings
你可以从这里查看所有的分割设置的方法:https://code.djangoproject.com/wiki/SplitSettings。
#2
0
Older relevant thread talking about per application settings:
旧的相关线程讨论每个应用程序设置:
http://groups.google.com/group/django-developers/browse_thread/thread/fc8b2e284459f6cf
http://groups.google.com/group/django-developers/browse_thread/thread/fc8b2e284459f6cf
You can run multiple django instances on a single domain with different settings using the advice from here:
使用下面的建议,您可以在单个域中使用不同的设置运行多个django实例:
multiple instances of django on a single domain
django在一个域中的多个实例
#3
-1
It's not pretty, but you can put the following in your settings.py
after INSTALLED_APPS
:
它并不漂亮,但是你可以在你的设置中加入以下内容。py INSTALLED_APPS之后:
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
for app in INSTALLED_APPS:
local_settings = os.path.join(PROJECT_DIR, app, 'local_settings.py')
if os.path.isfile(local_settings):
execfile(local_settings)
#1
2
you could check all ways of splitting up your settings from here: https://code.djangoproject.com/wiki/SplitSettings
你可以从这里查看所有的分割设置的方法:https://code.djangoproject.com/wiki/SplitSettings。
#2
0
Older relevant thread talking about per application settings:
旧的相关线程讨论每个应用程序设置:
http://groups.google.com/group/django-developers/browse_thread/thread/fc8b2e284459f6cf
http://groups.google.com/group/django-developers/browse_thread/thread/fc8b2e284459f6cf
You can run multiple django instances on a single domain with different settings using the advice from here:
使用下面的建议,您可以在单个域中使用不同的设置运行多个django实例:
multiple instances of django on a single domain
django在一个域中的多个实例
#3
-1
It's not pretty, but you can put the following in your settings.py
after INSTALLED_APPS
:
它并不漂亮,但是你可以在你的设置中加入以下内容。py INSTALLED_APPS之后:
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
for app in INSTALLED_APPS:
local_settings = os.path.join(PROJECT_DIR, app, 'local_settings.py')
if os.path.isfile(local_settings):
execfile(local_settings)