This issue of how to best organize private and local django settings came up at a recent hackfest I attended. Some googling revealed postings by Adrian and others that essentially noted that it's reasonable to assume that different programmers will choose to handle this differently, and, as Malcolm noted above, "...it's a Python file, so feel free to use the full power of the language as you wish."
That last idea, though often noted in the documentation, is easy for newbies like myself to forget. My thanks to the developers and others on this list for repeating it. For me a lightbulb went on: "Oh, so I can just import a settings_local.py file? Yes!" The solution I currently use is to have my distributed and subversioned settings.py file look like this (excerpt): > # Django settings for easyborrow project. > > import settings_local > > DEBUG = settings_local.DEBUG > > DATABASE_ENGINE = settings_local.DATABASE_ENGINE > DATABASE_NAME = settings_local.DATABASE_NAME > DATABASE_USER = settings_local.DATABASE_USER > DATABASE_PASSWORD = settings_local.DATABASE_PASSWORD > DATABASE_HOST = settings_local.DATABASE_HOST > DATABASE_PORT = settings_local.DATABASE_PORT > > TIME_ZONE = 'America/New_York' > > LANGUAGE_CODE = 'en-us' > > MEDIA_ROOT = settings_local.MEDIA_ROOT > MEDIA_URL = settings_local.MEDIA_URL > > SECRET_KEY = settings_local.SECRET_KEY > > [etcetera] ...and then settings_local.py will look like: > # [start] > > # DEBUG = False # production > DEBUG = True # development - birkin > > DATABASE_ENGINE = 'mysql' > DATABASE_NAME = 'thedbname' > DATABASE_USER = 'theusername' > DATABASE_PASSWORD = 'thepassword' > DATABASE_HOST = 'thehost' > DATABASE_PORT = '3306' > > # MEDIA_ROOT = '/opt/local/apache2/htdocs/django_media/easyborrow/' # > production > MEDIA_ROOT = '/Users/birkin/Sites/django_media/easyborrow_media/' # > development - birkin > > # MEDIA_URL = 'http://sisko.services.brown.edu/django_media/easyborrow/' # > production > MEDIA_URL = 'http://127.0.0.1/~birkin/django_media/easyborrow_media/' # > development - birkin > > SECRET_KEY = 'abcdefg_etc' > > # [end] So I do leave some hard-coded values in the settings.py file, taking out the ones that are clearly private and those that I think are most likely to be changed by others. Another developer I know *just* uses the line 'import settings_local' in his main distributed settings.py file, which works fine, but I like my way better (surprise) because it let's folk explicitly know in one place all the settings that need to be specified. A last comment... Ned wrote... "Sometimes, when a topic comes up over and over, it means something is wrong..." Sometimes. But it could also be a natural result of the interplay of keeping the tutorial simple and that most folk here are friendly and welcoming of newbies asking about best- practices. Hearing a common question and directing them/us to past threads, posts about options, and documentation is also reasonable. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---