japhyr japhyr - 1 year ago 123
Python Question

NoMigrations error in Django

I am building an app called 'competencies'. I made changes to models, migrated the app locally, and everything worked. This is my eighth migration on the app.

I have deployed the app on heroku, so I committed changes and pushed to heroku. I can see that the changes went through, because the new migrations appear in the heroku files. When I log in to heroku and try to migrate the competencies app, I get the following error:

NoMigrations: Application '<module 'django.contrib.admin' from '/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/__init__.py'>' has no migrations.

I have searched for this error, and I have not found anything meaningful. Can anyone suggest what I am doing wrong, or how to address the issue?

Answer Source

django.contrib.admin should not have migrations. Contrib packages are not south managed.

If you EVER ran python manage.py schemamigration django.contrib.auth --XXX on your local it would create the migrations folder in your local copy's install of the venv's django. However, this will never get transferred to heroku.

test something for me. create a new copy of your site on your local machine

  • new DB
  • new virtualenv
  • new folder w/ new clone of repo

try to run python manage.py migrate if you get the same error its b/c you broke your virtualenv with south.

Something else you could try IF your database models have not changed a bunch since the last working copy:

  • roll your models back to the last working configuration
  • delete EVERY app's migrations folder
  • truncate south_migrations table
  • run python manage.py schemamigration --initial X for each of your apps.
  • push and migrate --fake
  • redo your model changes
  • create migrations for the model changes
  • push and migrate regularly
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download