#23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment) -------------------------------------+------------------------------------- Reporter: Daniel Menzel | Owner: Dan | Watson Type: Bug | Status: assigned Component: Migrations | Version: 1.7 Severity: Normal | Resolution: Keywords: migrations, .pyc, | Triage Stage: Ready for frozen, cx_Freeze | checkin Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Tim Graham): If third-party apps continue to support Python 2 until it's EOL in 2020, then there's a possibility pyc files will be generated. If we revert 51673c146e48ff6230eace39bac18fd555607bee, then using a version of Django that doesn't ignore pyc files will given an exception like `ImportError: bad magic number in 'polls.migrations.0002_auto_20180312_1426': b'\x03\xf3\r\n'` if a Python 2 pyc file is present. Manually removing pyc files fixes that. If we decided to revert 51673c146e48ff6230eace39bac18fd555607bee for Django 2.1, I think it would be useful to add a more helpful message about the magic number error instructing the user to manually remove pyc files. I'm not sure if the extra hassle in that use case is worth the trade off of supporting frozen environments (assuming that Python 3 frozen environments generate pyc files -- I'm not sure about this as I haven't used frozen environments before). By Django 3.1 (released August 2020), I think we can safely assume most apps won't support Python 2, so we could revert the pyc ignoring in Django without much concern. The `MIGRATIONS_INCLUDE_PYC` setting would allow more easily using frozen environments in Django 2.1 (to be released August 2018), two years earlier than if we take the alternate route. Given the problem is there since Django 1.7 (September 2014), I don't know if two more years makes much difference. -- Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:34> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.1ab2766e2be48eaa1b1555cb8aec5db3%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.