5👍
✅
Your question starts from a premise that most Django programmers wouldn’t accept: that you can or should create URLs dynamically from the database. If you’re doing that, you’re doing it wrong.
Your URL patterns are part of the code, not the data. Obviously, the URLs themselves are formed by combining the patterns with the data – eg foo/<slug>/bar/
, but this doesn’t need reloading when new slugs are added because it is resolved by the view, not the URL processor.
0👍
import sys
from django.conf import settings
from django.core.urlresolvers import clear_url_caches
clear_url_caches()
reload(sys.modules[settings.ROOT_URLCONF])
- [Django]-Django Heroku not serving static files when Debug=False
- [Django]-Manual Post Save Signal creation makes the application slow, Django
- [Django]-Is dividing a template into parts and including each part bad?
- [Django]-How do I install the yaml package for my PyCharm Python project?
- [Django]-Django connect mysql problem, NameError: name '_mysql' is not defined
Source:stackexchange.com