On Oct 29, 4:50 pm, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> Django's dependence on DJANGO_SETTINGS_MODULE is an oft-lamented
> problem. Suggestions on how to address this constraint are most
> welcome.

With an explicit main (i.e. a single explicit entry point to code).
Would also fix the "where can I initialize stuff" problem for good.

> However, it isn't a simple problem to fix.

With the current design, no. I personally use the following
idiom for an entry-point template with Werkzeug/GAE.

Think of `fw` as `django` in the following.

---

from fw.conf import settings

from . import settings as proj_settings

settings.register(proj_settings)

# all kinds of interesting explicit overrides
# and optimizations are possible now,
# just a random example that would
# be messy with current code
if settings.MIDDLEWARE_CLASSES:
    from fw.core.handlers import MiddlewareHandler as Handler
else:
    from fw.core.handlers import BaseHandler as Handler

from fw.webapp import run_wsgi_app

from .urls import url_map
handler = Handler(url_map)

def main(): # <-- the entry point
    run_wsgi_app(handler) # or whatever

---

Disclaimer: I think that the Django way of doing things is
mostly fine and the effort to change the status quo is not
justified.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to