On 08/09/06 16:50, plungerman wrote: > greetings, > > what would be the best way to manage the settings files for multiple > websites that use the same django project? we have a django project > with 3 applications that we want to use for various clients. through > apache, we set up the virtual host stuff for their domain and send all > python/django requests via mod_python to the same project location > while using different settings files for each site. we want separate > databases and have different template directories and even different > applications available to each client. basically, then, we need a > different settings.py file for each client. most of the values would > be the same across the disparate clients, with the exception of things > like TEMPLATE_DIRS, DATABASE stuff, maybe a few other things. my idea > was to use the custom default settings described here: > > http://www.djangoproject.com/documentation/settings/#creating-your-own-settings > > is that the best way to go about this? i tried the method described > therein and mod_python threw an error, complaining about ROOT_URLCONF, > saying > > AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF' > > here is what i have in the client specific settings file. as you can > see, i import the custom defaults (my_settings) and then over-ride the > defaults using the configure() method: > > from django.conf import settings > from myapp import my_settings > > settings.configure( > default_settings=my_settings, > DEBUG = False, > TEMPLATE_DEBUG = False, > DATABASE_ENGINE = 'mysql', > DATABASE_NAME = 'blah', > DATABASE_USER = 'blah', > DATABASE_PASSWORD = 'blah', > MEDIA_ROOT = '/path/to/media/dir/', > MEDIA_URL = '/django_media/clientmedia/', > ROOT_URL = '/', > ROOT_URLCONF = 'iris.urls-client1', > TEMPLATE_DIRS = ( '/path/to/template/dir/',), > ) > > btw, ROOT_URL is a custom setting, if you are confused by that bit. > > any thoughts on this error or on a better way to deploy multiple sites > using the same project and applications? > > yours, > > steve >
The following works for me. /path/to/myapp/settings.py: from settings_default import * # relative import DEBUG = False TEMPLATE_DEBUG = False DATABASE_ENGINE = 'mysql' DATABASE_NAME = 'blah' DATABASE_USER = 'blah' DATABASE_PASSWORD = 'blah' MEDIA_ROOT = '/path/to/media/dir/' MEDIA_URL = '/django_media/clientmedia/' ROOT_URL = '/' ROOT_URLCONF = 'iris.urls-client1' TEMPLATE_DIRS = ( '/path/to/template/dir/',) Where /path/to/myapp/settings_default.py would contain what you now have in my_settings.py. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---