Upgrading from python-social-auth 0.2.19 to social-auth-core 1.4.0 + social-auth-app-django 1.2.0

I had a few issues upgrading to the initial social-auth-core packaging when it first became available. Yesterday I was able to get my applications to work with the latest version, which in turn allowed me to move from Django 1.10 to Django 1.11.

You will most likely encounter failed Django migrations when making the switch. Some posts on the ‘net recommend first upgrading to an intermediate version of python-social-auth to resolve that, but I wanted a simpler production switchover, which I found in this ticket.

The eventual production deploy solution after testing locally with a copy of the production database was:

  1. Temporarily hack my Ansible deploy script to fail after updating the source tree and virtualenv for the new libraries but before running migrations.

  2. On the server, as the project user, run pip uninstall python-social-auth to delete the old package.

  3. On the server, make another copy of the production database and then run this command via psql:

    update django_migrations set app='social_django' where app='default';
  4. On the server, as the project user, run:

    $ python manage.py migrate social_django 0001 --fake
  5. Remove the temporary fail from my Ansible deploy script.

  6. Run the deploy again, which will run the remaining migrations.