I'm trying to set up test for some URLS that are set only in debug. They are not set because apparently the value of DEBUG change to False between my setting file and urls.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 :
from django.conf import settings
from my_views import dnfp
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: []
If I change the value myself in urls.py the url is set again and the test works with this urls.py :
from django.conf import settings
from my_views import dnfp
settings.DEBUG = True
if settings.DEBUG:
urlpatterns += [url(r'^dnfp/$', dnfp, name="debug_not_found_page"...
Any ideas when and why my value for DEBUG is changing between settings and urls ?