#3687: django.conf.settings reads DJANGO_SETTINGS_MODULE at import time
--------------------------------------+-------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Template system
Version: 0.95 | Resolution:
Keywords: | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
--------------------------------------+-------------------------------------
Comment (by [EMAIL PROTECTED]):
Apparently it was the template import that broke it.
{{{
#!python
>>> from django.conf import settings
>>> from django import template
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
undefined.
}}}
Interleaving a configure() call fixed it:
{{{
#!python
>>> from django.conf import settings
>>> settings.configure(TEMPLATE_DIRS=('/home/username/templates'))
>>> from django import template
}}}
The docs could be a bit more explicit about what "using" code before
calling configure() means. Calling code in the middle of imports is a bit
unintuitive (and ugly, at least to me).
--
Ticket URL: <http://code.djangoproject.com/ticket/3687#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---