from constance import config
if not config.L7V_INITIALIZATED:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^initialization/', include('apps.initialization.urls'), name='initialization'),
]
else:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^dashboard/', include('apps.dashboard.urls')),
url(r'^vmAPI/', include('apps.vmAPI.urls')),
url(r'^protobook/', include('apps.protobook.urls')),
]
config.L7V_INITIALIZATED is just a boolean updated if initialization has been success.
So, in my initialization view, I set the boolean to True and need to reload settings.ROOT_URLCONF to understand the new list of urlpatterns.
I saw a snippet but doesn't work under django 1.9 (says working under django 1.4) :
import sys
from django.conf import settings
def reload_urlconf(urlconf=None):
if urlconf is None:
urlconf = settings.ROOT_URLCONF
if urlconf in sys.modules:
reload(sys.modules[urlconf])
I also tried the method 'django.core.urlresolvers.set_urlconf' but doesn't works......
Any suggestions ?
Thanks a lot !
Thomas
config.L7V_INITIALIZATED
I raise a 404 exception.
No need to reload urls.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2ac2ea9e-55eb-479f-9e30-271aeece1c26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.