Nitin Savant
Nitin Savant

Reputation: 961

relation does not exist when deploying django app to Heroku

I'm trying to deploy my django/postgres app to Heroku and running into an error when running this command:

(menv)Nitins-MacBook-Air:lists Nitin$ heroku ps:scale web=1
Scaling dynos... done, now running web at 1:Free.
(menv)Nitins-MacBook-Air:lists Nitin$ heroku run python manage.py syncdb
Running `python manage.py syncdb` attached to terminal... up, run.9322
 !    
 !    Error connecting to dyno, see https://devcenter.heroku.com/articles/one-off-dynos#timeout-awaiting-process

When I then launch my heroku site, I receive this browser error:

ProgrammingError at /movies/
relation "movies_movie" does not exist
LINE 1: SELECT COUNT('*') AS "__count" FROM "movies_movie"

I initially thought there was an issue with the Heroku database, but after creating a new one, I'm seeing the same error. Locally, however, with my local database settings, my site loads successfully with 'foreman start'.

So something doesn't add up for me. Any ideas?

Upvotes: 3

Views: 1884

Answers (2)

Mimo
Mimo

Reputation: 11

Similar to @Ajay solution. I ended up solving the issue with resetting the whole Database. From Heroku web dashboard, chose Databases then chose my database in that page and then under settings button Reset Database...

Just in case, you can back up database from web interface as well before deleting everything.

Upvotes: 1

Ajay Gupta
Ajay Gupta

Reputation: 1285

You can try recreating the full database if there is no data present.

Heroku gives you a Postgres database by default. To completely remove it run:

heroku addons:destroy heroku-postgresql:dev

Now create new one with:

heroku addons:create heroku-postgresql:dev

Upvotes: 1

Related Questions