Just checked the source that I was using. Definitely 1.7.4 and the local
version of django I have reads:
95 for name in os.listdir(directory):
> 96 if name.endswith(".py"):
> 97 import_name = name.rsplit(".", 1)[0]
> 98 if import_name[0] not in "_.~":
> 99 migration_names.add(import_name)
which is expected. Yet I am absolutely certain that migrations were failing
until I cleared out old bytecode. Perhaps there was some other bytecode
that was causing the problem which was not immediately related to the
migrations, but I am not certain.
On Wednesday, February 11, 2015 at 1:06:05 PM UTC-8, Collin Anderson wrote:
>
> Hah. Check out this ticket :) https://code.djangoproject.com/ticket/23406
>
> On Wed, Feb 11, 2015 at 4:04 PM, abhillman <[email protected]
> <javascript:>> wrote:
>
>> I have gotten bitten by lingering bytecode in migrations on several
>> occasions. Steps to reproduce are a little bit complex, but here is an
>> rough example:
>>
>> Local Box:
>> — have *.pyc rule in .gitignore
>> — create some migrations
>> — commit them
>>
>> Server Box:
>> — pull repository
>> — execute migrations
>>
>> Local Box:
>> — remove migrations
>> — commit
>> — create new initial migration
>>
>> Server Box:
>> — pull repository
>> — remove migrations history from db
>> — run fake initial migration — get an error here
>>
>> At this point, the server box has a migrations directory that looks
>> something like this (bytecode is still around because it was in the
>> gitignore):
>> — migrations
>> — __init__.py
>> — 0001_initial.py
>> — 0001_initial.pyc
>> — 0002_second.pyc
>> — 0003_third.pyc
>>
>> When running "python manage migrate" the bytecode appears to be
>> referenced, which often causes errors when running the migrations. When
>> using git, for example "git clean -df" clears out the problem. What I am
>> wondering is if it might make sense to make a deliberate attempt to ignore
>> bytecode without accompanying *.py files. This appears to be an issue
>> because of the way that migrations dynamically import python code, but I am
>> not sure. Perhaps the problem is more subtle as I am not deeply familiar
>> with the way that migrations work.
>>
>> aryeh
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/1dbf1434-b24a-47c9-b45b-ae04530d7867%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/django-developers/1dbf1434-b24a-47c9-b45b-ae04530d7867%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/4956f2f7-8e77-441c-8d90-20508eca04d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.