On 03/22/2011 07:05 PM, Ian Kelly wrote: > On Tue, Mar 22, 2011 at 4:49 PM, Matt Robenolt > <youdontevenk...@gmail.com> wrote: >> Why not just do an import for your custom settings? >> >> try: >> from site_settings import * >> except ImportError: >> pass > > No particularly compelling reason that I know of, the import machinery > is just unnecessary in this case. The site_settings.py is viewed as > an extension of the settings.py, so it doesn't need to be loaded as a > module in its own right. And for the same reason we know exactly > where we expect the file to be, so there's no need to consult > sys.path. > > I suppose it just comes down to a matter of taste.
Interesting. I would have assumed that the reason is so that code in site_settings.py has access to the previously defined values in the main settings.py, and can actually modify them (i.e. append to MIDDLEWARE_CLASSES or whatnot). With an import this is not possible. Carl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.