I'm trying to set up test for some URLS that are set only if we're in debug. They are not set because apparently the value of DEBUG change between my setting file and url.py. I've never encountered this problem before, and I don't remember doing anything particularly fancy involving DEBUG value.
Here's my urls.py :
print "settings.DEBUG in url: {}".format(settings.DEBUG)
if settings.DEBUG:
urlpatterns += [url(r'^dnfp/$', dnfp, name="debug_not_found_page"...
Here's my setting file :
DEBUG=True
print "DEBUG at the end of the settings: {}".format(DEBUG)
The content that fail in my test :
reverse("debug_not_found_page"),
Here's the output of the test :
DEBUG at the end of the settings: True
settings.DEBUG in url: False
Creating test database for alias 'default'...
.E
(...)
NoReverseMatch: Reverse for 'debug_not_found_page' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
The reverse is working if I add "settings.DEBUG=True" at the beggining of my url.py file.
Any ideas when and why my value for DEBUG is changing between settings and urls ?
Aucun commentaire:
Enregistrer un commentaire