Loading django/db/migrations/writer.py +6 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ class MigrationWriter(object): # See if we can import the migrations module directly try: migrations_module = import_module(migrations_package_name) # Python 3 fails when the migrations directory does not have a # __init__.py file if not hasattr(migrations_module, '__file__'): raise ImportError basedir = os.path.dirname(migrations_module.__file__) except ImportError: app_config = apps.get_app_config(self.migration.app_label) Loading tests/migrations/migrations_test_apps/without_init_file/migrations/.keep 0 → 100644 +0 −0 Empty file added. tests/migrations/test_writer.py +1 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ class WriterTests(TestCase): test_apps = [ 'migrations.migrations_test_apps.normal', 'migrations.migrations_test_apps.with_package_model', 'migrations.migrations_test_apps.without_init_file', ] base_dir = os.path.dirname(os.path.dirname(__file__)) Loading Loading
django/db/migrations/writer.py +6 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ class MigrationWriter(object): # See if we can import the migrations module directly try: migrations_module = import_module(migrations_package_name) # Python 3 fails when the migrations directory does not have a # __init__.py file if not hasattr(migrations_module, '__file__'): raise ImportError basedir = os.path.dirname(migrations_module.__file__) except ImportError: app_config = apps.get_app_config(self.migration.app_label) Loading
tests/migrations/migrations_test_apps/without_init_file/migrations/.keep 0 → 100644 +0 −0 Empty file added.
tests/migrations/test_writer.py +1 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ class WriterTests(TestCase): test_apps = [ 'migrations.migrations_test_apps.normal', 'migrations.migrations_test_apps.with_package_model', 'migrations.migrations_test_apps.without_init_file', ] base_dir = os.path.dirname(os.path.dirname(__file__)) Loading