diff options
| author | Tom Forbes <tom@tomforb.es> | 2019-07-21 22:28:39 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-24 14:38:24 +0200 |
| commit | 4d6449e1258c88b6e4e1ccbb5e84b210371598d2 (patch) | |
| tree | 668a4e939f44bf6ffca81fdb21d53bd93f5f9b5c /django/utils/autoreload.py | |
| parent | 61d4a159899358e3570dfc5db039651325b30992 (diff) | |
[2.2.x] Fixed #30647 -- Fixed crash of autoreloader when extra directory cannot be resolved.
Backport of fc75694257b5bceab82713f84fe5a1b23d641c3f from master.
Diffstat (limited to 'django/utils/autoreload.py')
| -rw-r--r-- | django/utils/autoreload.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 3153f3f14d..aa152343d6 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -235,8 +235,15 @@ class BaseReloader: def watch_dir(self, path, glob): path = Path(path) - if not path.is_absolute(): - raise ValueError('%s must be absolute.' % path) + try: + path = path.absolute() + except FileNotFoundError: + logger.debug( + 'Unable to watch directory %s as it cannot be resolved.', + path, + exc_info=True, + ) + return logger.debug('Watching dir %s with glob %s.', path, glob) self.directory_globs[path].add(glob) |
