I put all in urls and check permissions with
https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.decorators.user_passes_test
so if not https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.decorators.user_passes_test
config.L7V_INITIALIZATED
I raise a 404 exception.
No need to reload urls.
2016-06-23 8:02 GMT-06:00 Thomas <thomas.dulu@gmail.com>:
Hy django lovers,--it's my first post for being helped, sorry if I miss something.I want two list of urls available :
- one (limited) before initializing (verify licence, etc...)
- one (large) after initializing success
Here is my settings.ROOT_URLCONF :
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
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.
--
"La utopía sirve para caminar" Fernando Birri
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAG%2B5VyMeYSsGq6g2h2niY9Kde%2BZevHdq6hnddSuLBV8L14iqTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment