Jefrey Bulla
Jefrey Bulla

Reputation: 191

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.

Upvotes: 4

Views: 4897

Answers (2)

Taufiq Muhammadi
Taufiq Muhammadi

Reputation: 352

I follow the direction from Mike Ball here successfully: http://www.mikeball.us/blog/using-south-on-heroku/

Like CraigKerstiens answer said, you should make the migration locally first then push to heroku. Before you make a migration on Heroku, make sure you convert your Heroku instance into south, for example

heroku run bin/python django_project/manage.py convert_to_south django_app

Upvotes: 5

CraigKerstiens
CraigKerstiens

Reputation: 5954

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

Upvotes: 10

Related Questions