summaryrefslogtreecommitdiff
path: root/django/db/migrations/loader.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/migrations/loader.py')
-rw-r--r--django/db/migrations/loader.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
index 8a1cf431bd..a6fe1afc15 100644
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -84,8 +84,9 @@ class MigrationLoader:
continue
raise
else:
- # PY3 will happily import empty dirs as namespaces.
- if not hasattr(module, '__file__'):
+ # Empty directories are namespaces.
+ # getattr() needed on PY36 and older (replace w/attribute access).
+ if getattr(module, '__file__', None) is None:
self.unmigrated_apps.add(app_config.label)
continue
# Module is not a package (e.g. migrations.py).