INSTALLED_APPS += ("debug_toolbar",)
from settings.base import *INSTALLED_APPS += ("debug_toolbar",)
--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/NIyPsTXK5po/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.
I’ve been thinking about this for quite some time personally.
The local_settings.py approach does lead to some unpleasant quirks sometimes, and the multi-settings-file approach Paul mentioned is being advocated by many lately, including PyDanny (in his Two Scoops of Django and many other occasions) and core Django developers.
I did personally use the multi-settings-file approach in some of my Mezzanine projects. Works fine for most of the functionalities as far as I am aware. There is, however, one big obstacle to adopt this for all Mezzanine projects: dynamic settings. What Mezzanine currently does is invoking set_dynamic_settings at the end of the settings.py file, after local_settings.py is imported. So things basically happen in the following order when a server starts: [1]
With this order, dynamic settings would contain all entries from general and user-specific settings, with the latter overrides general ones. But with the multi-settings-file approach, this is not that trivial to achieve. Since we use different settings files in different occasions, in order to invoke set_dynamic_settings after all settings (general and user-specific) are loaded, we’ll need to add set_dynamic_settings at the end of every setting files we wish to use. Which is obviously ugly and error-prone.
The idea is that since we can’t put the logic inside the settings files, it need to be hooked somewhere during Django’s standard startup sequence. But I’m yet to find a good place for this. A Django project has quite a few entry points (e.g. for runserver, test, and for begin served via a real WSGI server), and none of them provide good ways for hooks.
Would be glad if there are any thoughts on this. I’ve been troubled by the local_settings approachfor quite some time now, and would be more than happy if it could be improved or even go away completely.
[1]: This is not actually accurate since Django settings are loaded lazily, not on application startup. But for the purpose of this article it’s close enough.