diff options
Diffstat (limited to 'django/utils/autoreload.py')
| -rw-r--r-- | django/utils/autoreload.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index d33ee9096d..3a0d5fbe73 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -120,7 +120,9 @@ def iter_modules_and_files(modules, extra_files): # __main__ (usually manage.py) doesn't always have a __spec__ set. # Handle this by falling back to using __file__, resolved below. # See https://docs.python.org/reference/import.html#main-spec - sys_file_paths.append(module.__file__) + # __file__ may not exists, e.g. when running ipdb debugger. + if hasattr(module, '__file__'): + sys_file_paths.append(module.__file__) continue if getattr(module, '__spec__', None) is None: continue |
