Handle all cases of login.
Firstly refactor the code to move all the post login mechanisms to a
function of its own.
Then add support to redirect the user if the login was attempted from
logout page.
Finally if the post response we got contains html, it is not a valid
JSON, which means the login failed. In this case catch the exception
and show the login error.
#! /bin/bash
sudo -u postgres dropdb pytask
sudo -u postgres createdb -O pytask pytask
rm -r pytask/profile/migrations/
rm -r pytask/taskapp/migrations/
./bin/django schemamigration profile --initial
./bin/django schemamigration taskapp --initial
./bin/django syncdb
./bin/django migrate profile
./bin/django migrate taskapp
./bin/django loaddata sites_fixture.json
./bin/django loaddata profile_fixture.json