mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #21015 -- Fixed MigrationLoader when importlib.import_module returns a file module or an empty directory.
This commit is contained in:
@@ -64,6 +64,13 @@ class MigrationLoader(object):
|
||||
self.unmigrated_apps.add(app_label)
|
||||
continue
|
||||
raise
|
||||
else:
|
||||
# PY3 will happily import empty dirs as namespaces.
|
||||
if not hasattr(module, '__file__'):
|
||||
continue
|
||||
# Module is not a package (e.g. migrations.py).
|
||||
if not hasattr(module, '__path__'):
|
||||
continue
|
||||
self.migrated_apps.add(app_label)
|
||||
directory = os.path.dirname(module.__file__)
|
||||
# Scan for .py[c|o] files
|
||||
|
||||
Reference in New Issue
Block a user