Changes between Initial Version and Version 5 of Ticket #30300
- Timestamp:
- Mar 29, 2019, 9:29:21 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #30300
- Property Owner changed from to
- Property Status new → assigned
- Property Triage Stage Unreviewed → Accepted
- Property Type Bug → New feature
- Property Summary migrate silently ignores apps whose migrations directory doesn't have an __init__.py → Allow migrations directories without __init__.py files
-
Ticket #30300 – Description
initial v5 1 1 Background: In python 3 a package with no `__init__.py` is implicitly a namespace package, so it has no `__file__` attribute. 2 2 3 The migrate command currently checks for existence of a `__file__` attribute on the `migrations` package. This check was introduced in https://code.djangoproject.com/ticket/21015, because the `__file__` attribute was used in migration file discovery.3 The migrate command currently checks for existence of a `__file__` attribute on the `migrations` package. This check was introduced in #21015, because the `__file__` attribute was used in migration file discovery. 4 4 5 However, in https://code.djangoproject.com/ticket/23406 migration file discovery was changed to use `pkgutil. iter_modules ()`, instead of direct filesystem access.`pkgutil. iter_modules()` uses the package's `__path__` list, which exists on implicit namespace packages.5 However, in #23406 migration file discovery was changed to use `pkgutil.iter_modules ()`, instead of direct filesystem access. `pkgutil. iter_modules()` uses the package's `__path__` list, which exists on implicit namespace packages. 6 6 7 7 As a result, the `__file__` check is no longer needed, and in fact prevents `migrate` from working on namespace packages (implicit or otherwise). 8 8 9 10 Related work: https://code.djangoproject.com/ticket/29091 9 Related work: #29091