﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5049	[PATCH] Application settings import	Joshua 'jag' Ginsberg <jag@…>	Adrian Holovaty	"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"		closed	Core (Other)	dev		wontfix			Unreviewed	1	0	0	0	0	0
