1
0
mirror of https://github.com/django/django.git synced 2025-10-30 00:56:09 +00:00

[1.8.x] Fixed #24848 -- Fixed ValueError for faulty migrations module.

Added apps to unmigrated apps if the migrations module is a file
or a folder missing __init__.py.

Thanks to Ernest0x for the bug report.

Backport of d73176a842 from master
This commit is contained in:
Marten Kenbeek
2015-05-24 21:17:39 +02:00
committed by Tim Graham
parent 122e688a9c
commit 1ac4c7d415
3 changed files with 15 additions and 2 deletions

View File

@@ -77,9 +77,11 @@ class MigrationLoader(object):
else:
# PY3 will happily import empty dirs as namespaces.
if not hasattr(module, '__file__'):
self.unmigrated_apps.add(app_config.label)
continue
# Module is not a package (e.g. migrations.py).
if not hasattr(module, '__path__'):
self.unmigrated_apps.add(app_config.label)
continue
# Force a reload if it's already loaded (tests need this)
if was_loaded: