Created
July 29, 2014 10:24
-
-
Save anentropic/9ac47f6518c88fa8d2b0 to your computer and use it in GitHub Desktop.
reload Django urlconf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reload_urlconf(urlconf=None, urls_attr='urlpatterns'): | |
if urlconf is None: | |
urlconf = settings.ROOT_URLCONF | |
if urlconf in sys.modules: | |
reload(sys.modules[urlconf]) | |
reloaded = import_module(urlconf) | |
reloaded_urls = getattr(reloaded, urls_attr) | |
set_urlconf(tuple(reloaded_urls)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment