#5049 closed (wontfix)
[PATCH] Application settings import
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We develop lots of utility applications that include many customizable configuration settings. Installing them all and modifying settings.py to include all of the settings makes our settings.py complex and unwieldly. Thus we felt that these application-specific settings should be pushed out to settings.py files in each specific application so that the defaults are always defined, and to allow each project/site to override these application defaults by creating <app_name>.py in a project subfolder called app_settings.
This is best described with an example. My project in this example is skwx and my app is cienfuegos.
$ ./manage.py shell Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import os >>> os.listdir('/srv/skwx') ['manage.py', '__init__.py', 'settings.py', 'urls.py', 'svn', 'cienfuegos', '__init__.pyc', 'django.db', 'app_settings', 'settings.py~', 'settings.pyc'] >>> os.listdir('/srv/skwx/cienfuegos') ['views.py', '__init__.py', 'models.py~', '__init__.pyc', 'svn-post-commit.py~', 'svn-post-commit.py', 'models.py', 'models.pyc', 'settings.py', 'settings.py~', 'settings.pyc'] >>> os.listdir('/srv/skwx/app_settings') ['__init__.py', 'cienfuegos.py', '__init__.pyc', 'cienfuegos.pyc'] >>> print open('/srv/skwx/cienfuegos/settings.py').read() FOO='bar' bar='baz' WTF='ZOMFG!' >>> print open('/srv/skwx/app_settings/cienfuegos.py').read() FOO='not bar' >>> from django.conf import settings >>> settings.cienfuegos.FOO 'not bar' >>> settings.cienfuegos.WTF 'ZOMFG!'
Please let me know if you feel this could be appropriate for inclusion. Thanks!
-jag
Attachments (1)
Change History (3)
by , 17 years ago
Attachment: | django-settings.patch added |
---|
comment:1 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
As noted in the mailing list; this idea has come up in the past (search the archives) and we've decided against it.
Patch to django/conf/init.py