1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #21518 -- Made override_settings(ROOT_URLCONF) clear the resolver cache.

Thanks Aymeric Augustin and Simon Charette for reviews.
This commit is contained in:
Chris Wilson
2013-11-27 19:45:20 +00:00
committed by Tim Graham
parent 43510cffcb
commit 65131911db
2 changed files with 40 additions and 1 deletions

View File

@@ -124,3 +124,10 @@ def complex_setting_changed(**kwargs):
# stacklevel=5 shows the line containing the override_settings call.
warnings.warn("Overriding setting %s can lead to unexpected behaviour."
% kwargs['setting'], stacklevel=5)
@receiver(setting_changed)
def root_urlconf_changed(**kwargs):
if kwargs['setting'] == 'ROOT_URLCONF':
from django.core.urlresolvers import clear_url_caches
clear_url_caches()