Search code examples
djangomigrationdjango-1.7

Migrate an existant project from Django 1.6 to 1.7


I have a project running Django 1.6 with Python 2.7 and, for several reasons, I would like to upgrade to Django 1.7.

Consider that South has never been used in this project and that we have a custom user model (this is important to keep in mind because custom user models seem to clash with convert_to_south according to this ticket).

What would be the different steps to take in order to upgrade to Django 1.7 smoothly? My secret dream would be to avoid using South and directly take advantage of the native schema migration support of Django 1.7.


Solution

  • from the db point of view:

    • pip install django==1.7
    • run ./manage.py makemigrations
    • run ./manage.py migrate

    that's all

    for other compatibilities check release notes: https://docs.djangoproject.com/en/dev/releases/1.7/

    The main problems that you can find is related to the new application loading mechanism (ie you cannot use get_user_model() anywhere). There is no one way to solve it, depends by the code structure.

    some 'everywhere valid' point are:

    • if use custom user model. use always settings.AUTH_USER_MODEL in ForeignKeys
    • do not access to any Model in your __init__

    some reference: