diff options
| author | Tom Forbes <tom@tomforb.es> | 2019-04-29 10:22:43 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-29 11:41:00 +0200 |
| commit | 0636d4d2aa6e4469198fdf662225ad862e60c5e3 (patch) | |
| tree | cb1b5e51c5ae4cc1ba3c378e2bddc327d9be7184 | |
| parent | b5259ab78054a91f10804de460128879f7948ca4 (diff) | |
Refs #30323 -- Prevented crash of autoreloader when get_resolver().urlconf_module raising an exception.
| -rw-r--r-- | django/utils/autoreload.py | 7 | ||||
| -rw-r--r-- | docs/releases/2.2.1.txt | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 17631e15ef..dc7c9b2cea 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -272,7 +272,12 @@ class BaseReloader: from django.urls import get_resolver # Prevent a race condition where URL modules aren't loaded when the # reloader starts by accessing the urlconf_module property. - get_resolver().urlconf_module + try: + get_resolver().urlconf_module + except Exception: + # Loading the urlconf can result in errors during development. + # If this occurs then swallow the error and continue. + pass logger.debug('Apps ready_event triggered. Sending autoreload_started signal.') autoreload_started.send(sender=self) self.run_loop() diff --git a/docs/releases/2.2.1.txt b/docs/releases/2.2.1.txt index 9696488e14..4a2d77aaf3 100644 --- a/docs/releases/2.2.1.txt +++ b/docs/releases/2.2.1.txt @@ -64,3 +64,6 @@ Bugfixes permissions for proxy models if the target permissions already existed. For example, when a permission had been created manually or a model had been migrated from concrete to proxy (:ticket:`30351`). + +* Fixed a regression in Django 2.2 that caused a crash of :djadmin:`runserver` + when URLConf modules raised exceptions (:ticket:`30323`). |
