Opened 11 years ago
Last modified 10 years ago
#22577 closed Bug
The makemigrations management command has a problem with migrations dir — at Initial Version
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
When the migration folder does not have an init
http://codepad.com/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 comees from led me to line149 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