Saturday, March 28, 2015

How to upgrade Django 1.6 to Django 1.7

  • Update django package:

    pip install -U Django
  • Remove 'south' from INSTALLED_APPS.
  • Delete all your (numbered) migration files, but not the directory or - make sure you remove the .pyc files too.
  • Run python makemigrations. Django should see the empty migration directories and make new initial migrations in the new format.
  • Run python migrate. Django will see that the tables for the initial migrations already exist and mark them as applied without running them. (Only matching table names are checked; not their full schema
  • it’s up to you to make sure the existing schema is up to date with your models!)
  • Uninstall south package:

    pip uninstall south
  • Update requirements.txt file:

    pip freeze > requirements.txt


I'm using a great Python hosting - Webfaction. So here is short notes how to upgrade existing deployed application to Django 1.7.

  • Create new application with Django 1.7
  • Copy project folder from old Django 1.6 application to new Django 1.7 application.
  • Modify httpd.conf accordingly with new folder structure.
  • Stop existing existing application with django 1.6.
  • Restart new django 1.7 application:

  • Remove django 1.6 from Websites-> -> Contents.
  • Add new django 1.7 app to Websites-> -> Contents.

Done. Check how it works.

PS: And don't forgot to update fabric deployment file accordingly.

1 comment:

  1. I like your blog, I read this blog please update more content on python, further check it once at python online training