from django.db import models, migrations ImportError: cannot import name migrations

Pablo picture Pablo · Sep 3, 2014 · Viewed 11.3k times · Source

So I've started to experience some issues with south on my Django web server. Migrate command is failing with this output everytime:

from django.db import models, migrations

ImportError: cannot import name migrations 

(Above this the error displays the rout to the file that failed to be migrated)

My Django version is 1.5.1, while my south version is 0.8.4

The thing that troubles me the most is that the module django.db.migrations is nowhere to be found.

Any ideas?

Answer

sgarza62 picture sgarza62 · Sep 3, 2014

Migrations were introduced in Django 1.7; you are using 1.5.

Here is a link to the docs explaining this. If you're using an older version of Django, South is the most popular option for data migrations.


EDIT

So the Django Rest Framework is causing the error. From their documentation:

The rest_framework.authtoken app includes both Django native migrations (for Django versions >1.7) and South migrations (for Django versions <1.7) that will create the authtoken table.

Note: From REST Framework v2.4.0 using South with Django <1.7 requires upgrading South v1.0+

You must upgrade South beyond your version of 0.8.4 to 1.0+.