Reputation: 71
I'm having trouble with Django south migrations. It may be related to how we've laid our project out but it was working previously, and it works fine locally.
I pushed new code last night that contained a migration in my_app
app. So in my local environment...
$ ./manage.py migrate --list
socialaccount
(*) 0001_initial
(*) 0002_genericmodels
(*) 0003_auto__add_unique_socialaccount_uid_provider
(*) 0004_add_sites
(*) 0005_set_sites
(*) 0006_auto__del_field_socialapp_site
(*) 0007_auto__add_field_socialapp_client_id
(*) 0008_client_id
(*) 0009_auto__add_field_socialtoken_expires_at
(*) 0010_auto__chg_field_socialtoken_token
(*) 0011_auto__chg_field_socialtoken_token
payments
(*) 0001_initial
users
(*) 0001_initial
my_app
(*) 0001_initial
(*) 0002_auto__add_organizerapplication
In heroku, it doesn't recognize my_app as an app with migrations. When I attempt to migrate that app....
$ heroku run my_app/manage.py migrate my_app --app=my_app
Running my_app/manage.py migrate my_app attached to terminal... up, run.5016
The app 'my_app' does not appear to use migrations.
./manage.py migrate [appname] [migrationname|zero] [--all] [--list] [--skip] [--merge] [--no-initial-data] [--fake] [--db-dry-run] [--database=dbalias]
If I list the migrations, you'll notice my_app isn't listed...
$ heroku run my_app/manage.py migrate --list --app=my_app
Running my_app/manage.py migrate --list attached to terminal... up, run.8264
socialaccount
(*) 0001_initial
(*) 0002_genericmodels
(*) 0003_auto__add_unique_socialaccount_uid_provider
(*) 0004_add_sites
(*) 0005_set_sites
(*) 0006_auto__del_field_socialapp_site
(*) 0007_auto__add_field_socialapp_client_id
(*) 0008_client_id
(*) 0009_auto__add_field_socialtoken_expires_at
(*) 0010_auto__chg_field_socialtoken_token
(*) 0011_auto__chg_field_socialtoken_token
payments
(*) 0001_initial
users
(*) 0001_initial
I'm not sure it's relevant but my_app
is listed in my INSTALLED_APPS
when I check.
UPDATE
The issue was that this particular migrations dir was missing __init__.py.
Running commands like convert_to_south
through Heroku don't impact this as local file changes don't stick. Pushing the repo again with that file got the migrations recognized. I then just had to fake the first migration and I was good.
Upvotes: 4
Views: 1426
Reputation: 455
Make sure you have a init.py file in the migrations folder of the app you want to migrate. South will work locally, but not in production on heroku. Simply copy an init.py file from one of your apps, and put it into the migrations folder for the app you are getting the error for. Push that change to production, and then migrate.
Upvotes: 4