Files
edx-platform/common/djangoapps/util/url.py
Usman Khalid 6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00

23 lines
631 B
Python

"""
Utility functions related to urls.
"""
import sys
from django.conf import settings
from django.core.urlresolvers import set_urlconf
from importlib import import_module
def reload_django_url_config():
"""
Reloads Django's URL config.
This is useful, for example, when a test enables new URLs
with a django setting and the URL config needs to be refreshed.
"""
urlconf = settings.ROOT_URLCONF
if urlconf and urlconf in sys.modules:
reload(sys.modules[urlconf])
reloaded = import_module(urlconf)
reloaded_urls = getattr(reloaded, 'urlpatterns')
set_urlconf(tuple(reloaded_urls))