On Tue, Mar 31, 2009 at 2:21 PM, Travis Parker <travis.par...@gmail.com> wrote: > [snip] > > 2. settings (views -> apps, dj middleware -> wsgi middleware) > i don't have nearly as nice a proposal for dealing with this. there > are a lot of django views and middleware out there that would be nice > to have usable as wsgi components but which require > django.conf.settings to work. if they are going to go into a wsgi > environment though, it seems a little strange to require a > DJANGO_SETTINGS_MODULE environment variable and a django-style > settings.py. i don't have any great ideas. open for suggestions. > [snip]
It seems to be a little known/remembered fact that DJANGO_SETTINGS_MODULE and settings.py are not required to use django code that requires settings. Settings can actually be configured manually within python code calling settings.configure(). This way, you only actually set settings that you need. In fact, outside of the strict situation of a django project, it is the only way I deal with settings when using parts of django. See here for details: http://www.djangobook.com/en/1.0/appendixE/#cn57 However, the trick is that you can only call settings.configure() once and it's possible that multiple middleware will need settings. On top of that, the user may use some of those middlewhere and not others and/or change the order of the middlewhere. You'll need some way to work out whether configure has been called for each middlewhere and only call it the first time. Not fun, but it's got to be better than dealing with DJANGO_SETTINGS_MODULE and settings.py. -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---