Not sure if you're willing to consider an alternate, here, but this is a 
issue Iv'e gone through a lot, and came up with my own solution. The major 
issue is that I not only want to change the top level paths, but also need 
to change database targets and a few other settings, between all the 
different dev/beta/production sites AND to make sure that the majority of 
my settings can be checked into our SCM. Here's what I came up with.

Rename settings to common_settings.py

Have a local_settings.py that is NOT checked into the SCM (perhaps provide 
a local_settings.py.example containing the minimum settings that need to be 
changed).

local_settings.py contains:

from projectname.common_settings import *

DATABASES = ...
SECRET_KEY = ...
STATIC_ROOT = ...

and anything else that _must_ change between installations.

Then change manage.py and wsgi.py so that it loads "common_settings" rather 
than "projectname.settings"

and done.

The BIG advantage here is that you're not checking anything into the SCM 
that must remain secret, or must change (or very likely to change) between 
installations, but all other settings are source controlled.

Although not necessary to rename settings.py, i do this to catch code that 
improperly imports settings, rather than django.conf.settings



>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/n_Se5QJGg6sJ.
To post to this group, send email to django-users@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