1

Would anyone have any tips for deploying heroku django app with the hobby free postgres version that heroku provides? This error below in the traceback almost seems similar when I was testing locally if I didnt do a python manage.py migrate in the django build process.

Also new to django, heroku, and postgress to so tips greatly help. These are my steps using the heroku pipeline to deploy:

git push heroku master
heroku ps:scale web=1
heroku open

This is the trace back through heroku logs when I try to view the webpage:

2021-04-28T15:42:39.226298+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-28T15:42:46.842959+00:00 heroku[web.1]: Starting process with command `gunicorn mysite.wsgi --log-file -`
2021-04-28T15:42:50.000000+00:00 app[api]: Build succeeded
2021-04-28T15:42:50.613040+00:00 app[web.1]: [2021-04-28 15:42:50 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-04-28T15:42:50.614019+00:00 app[web.1]: [2021-04-28 15:42:50 +0000] [4] [INFO] Listening at: http://0.0.0.0:38735 (4)
2021-04-28T15:42:50.614239+00:00 app[web.1]: [2021-04-28 15:42:50 +0000] [4] [INFO] Using worker: sync
2021-04-28T15:42:50.624501+00:00 app[web.1]: [2021-04-28 15:42:50 +0000] [9] [INFO] Booting worker with pid: 9
2021-04-28T15:42:50.648659+00:00 app[web.1]: [2021-04-28 15:42:50 +0000] [10] [INFO] Booting worker with pid: 10
2021-04-28T15:42:51.320006+00:00 heroku[web.1]: State changed from starting to up
2021-04-28T15:43:08.733160+00:00 app[web.1]: Internal Server Error: /
2021-04-28T15:43:08.733171+00:00 app[web.1]: Traceback (most recent call last):
2021-04-28T15:43:08.733172+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
2021-04-28T15:43:08.733173+00:00 app[web.1]: return self.cursor.execute(sql, params)
2021-04-28T15:43:08.733174+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "blog_post" does not exist
2021-04-28T15:43:08.733174+00:00 app[web.1]: LINE 1: SELECT COUNT(*) AS "__count" FROM "blog_post" WHERE "blog_po...
2021-04-28T15:43:08.733175+00:00 app[web.1]: ^

UPDATE, as mentioned beautifully in the first comment, did you do the tutorial? I missed this when deploying to heroku the database section heroku run python manage.py migrate. Do the whole tutorial make sure it runs locally prior !

3
  • Have you tried following the Getting Started on Heroku with Python tutorial? Commented Apr 28, 2021 at 16:09
  • thanks Im checking this out... Commented Apr 28, 2021 at 16:16
  • Thanks for the tips here Ill post an update.... Commented Apr 28, 2021 at 16:38

1 Answer 1

2

glad that you figured it out

one advice add this line at the top of your Procfile.

release: python manage.py migrate

What this will do?
It will automatically run the command migrate on every push.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.