Opened 11 years ago
Last modified 10 years ago
#22577 closed Bug
The makemigrations management command has a problem with migrations dir — at Version 2
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Release blocker | Keywords: | makemigrations, fail, init, file |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When the migration folder does not have an init
http://codepad.org/U2nGptor
File "/home/archie/git/django/django/db/migrations/writer.py", line 150, in path basedir = os.path.dirname(migrations_module.__file__) AttributeError: 'module' object has no attribute '__file__'
the problem lies with makemigrations.py
line 134-36 they are checking to see if an init file exists in the migrations dir but it checks using a line that depends on the existence of __init__.py
. line 130 , writer.path
, following to see where this code comes from led me to line 149 and 150 which need there to be an init file for __file__
to be an attribute there ..
tl;dr
makemigrations
checks for an init file using os.path.isdir
but with a call that depends on an __init__.py
for it treats it as a module before it knows if it is a module