When this came up another time, a better approach was explained to me.
Rather than settings.py 'under version control'*, you keep
settings_default.py as your universal settings file. This is then
imported into settings.py.

The advantage of this is that you don't need to do clever tricks in
your settings.py to update things like INSTALLED_APPS,
MIDDLEWARE_CLASSES etc.

Having said that, I still import from setting_local in all my projects.

Cheers

Tom


* This is such a misnomer - *all* your source and configuration files
should be under version control, especially local settings (I keep
mine in a separate repository, which is then externall'ed into place
in the instance's deployment repo). How else can you effectively
control change management?

On Mon, Oct 25, 2010 at 7:37 AM, Steve Holden <holden...@gmail.com> wrote:
> On 10/25/2010 2:02 AM, Kenneth Gonsalves wrote:
> [shacker]
>>> Another approach to this problem:
>>>
>>> settings.py IS in version control and includes settings
>>> that are universal to all environments (local dev, staging,
>>> production), but has dummy info or empty strings for
>>> passwords or paths or other information that vary between
>>> environments.
>> this is a better approach - much more professional (I *did* say I
>> am an amateur;-))
>
> A technique I use, having picked it up from Jacob Kaplan Moss, IIRC, is
> to keep settings.py under source control but have it include as its last
> statement
>
> from local_settings import *
>
> The local_settings.py file is then maintained outside source control on
> each target platform. This works very nicely, and allows you to maintain
> common settings without having to edit a file that's under code control
> to vary settings between platforms.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9 http://djangocon.us/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to