Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make South works in Heroku for a Django app

I am working on Python/Django and I am trying to use South to manage my database. In local environment is working great. The problem comes when I deploy to Heroku. The issue is that when I create a migration with

$heroku run manage.py schemamigration mydjangoapp

It looks like it works (the shell confirmed it), however, then I try to use migrations and it won't work. When I do:

$heroku run python manage.py migrate mydjangoapp

I get this;

The app 'createtuto' does not appear to use migrations

I checked on the problem and it looks like heroku doesn't allow South to create the migration directory at /myDjangoapp/migrations.

Is there anything I can do to make it work?

I tried to use convert_to_south, but I got the same results: At the beginning it looks like it worked, but It did not, not migration created.

like image 816
Jefrey Bulla Avatar asked Dec 06 '22 15:12

Jefrey Bulla


1 Answers

When you run 'heroku run' it connects to an isolated instance of your deployed environment. It does create the migration, however that migration is not contained within your slug. Each time you do a 'git push heroku master' it installs your dependencies and packages your application into a slug. This is more or less a tarball of your application which enables Heroku to easily deploy it to new dynos as you scale up.

In order to run a migration on Heroku you would create the migration locally, check it in, then run the migration on heroku. Something similar to:

manage.py schemamigration mydjangoapp
git add mydjangoapp/migrations/*
git commit -m 'adding new migrations'
git push heroku master
heroku run python manage.py migrate mydjangoapp
like image 190
CraigKerstiens Avatar answered Dec 09 '22 14:12

CraigKerstiens