How to do southern work in Heroku for a Django application

I am working on Python / Django and I am trying to use the South to manage my database. It works great in the local environment. The problem occurs when I deploy to Heroku. The problem is that when I create a migration using

$heroku run manage.py schemamigration mydjangoapp 

It seems to work (the shell confirmed it), however, I am trying to use migrations, and this will not work. When I do this:

 $heroku run python manage.py migrate mydjangoapp 

I get this:

 The app 'createtuto' does not appear to use migrations 

I checked the problem, and it seems that the hero does not allow Sub to create the migration directory in / myDjangoapp / migrations.

Is there anything I can do to make it work?

I tried using convert_to_south, but I got the same results: at first it looks like it worked, but it did not, but did not create the migration.

+4
source share
2 answers

When you run "heroku run", it connects to an isolated instance of your deployed environment. It creates a migration, however this migration is not contained in your slug. Each time you run git push heroku master, it installs your dependencies and packs your application into a pool. This is more or less the tarball of your application, which allows Heroku to easily deploy it to new speakers when scaling.

To migrate to Heroku, you must create the migration locally, check it, and then start the migration to the hero. Something like:

 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 
+10
source

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

As CraigKerstiens said the answer is, you must first migrate and then click on the hero. Before you upgrade to Heroku, make sure you convert your Heroku instance to the south, for example

 heroku run bin/python django_project/manage.py convert_to_south django_app 
+5
source

Source: https://habr.com/ru/post/1401653/


All Articles