#23406: Migrations not found when only .pyc files are available (e.g. in a 
frozen
environment)
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  nobody
  danielmenzel           |     Status:  new
         Type:  Bug      |    Version:  1.7
    Component:           |   Keywords:  migrations, .pyc, frozen, cx_Freeze
  Migrations             |  Has patch:  0
     Severity:  Normal   |      UI/UX:  0
 Triage Stage:           |
  Unreviewed             |
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 == Description ==

 When only '''.pyc''' files are available, for example in a frozen
 environment after running ''cx_Freeze'' or similar tools, migrations no
 longer work: the migrate command does not find any migrations to apply,
 and produces the following output:

 {{{
 Operations to perform:
   Synchronize unmigrated apps: <some apps that really have no migrations>
   Apply all migrations: (none)
 Synchronizing apps without migrations:
   Creating tables...
     Creating table <some tables>
   Installing custom SQL...
   Installing indexes...
 Running migrations:
   No migrations to apply.
   Your models have changes that are not yet reflected in a migration, and
 so won't be applied.
   Run 'manage.py makemigrations' to make new migrations, and then re-run
 'manage.py migrate' to apply them.
 }}}

 Subsequent operations then fail because the database is unmigrated.

 The typical content of a frozen migrations folder looks like this:

 {{{
 django
   contrib
     contenttypes
       migrations
         __init__.pyc
         0001_initial.pyc
 }}}


 == Analysis ==

 Due to issue [https://code.djangoproject.com/ticket/23237], there was a
 change in django.db.migrations.loader
 
([https://code.djangoproject.com/changeset/267630ad50c69ebfe594de37a0636264aa5be7d6]):
 Previously, migrations were found if they had a '''.py''', '''.pyc''', or
 '''.pyo''' extension. Now only migrations with '''.py''' extensions are
 found.

 Perhaps it would be possible to add a check if Django is running in a
 frozen environment:

 {{{
 if hasattr(sys, 'frozen'):
     extensions = ('.py', '.pyc')
 else:
     extensions = ('.py', )
 ...
 if name.endswith(extensions):
     ...
 }}}

 or make the list of allowed extensions configurable by the user.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.7cd655e2c3bf63b7339739759b89274c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to