user2088432
user2088432

Reputation: 375

Heroku app with Django and postgres crashing unexpectdly

I am new to Django development, but I am in a situation where I need to deploy a large project on Heroku.

I ran my app in local system, it worked fine.

I pushed the same to Heroku and it also worked fine. But after few hours I open my app URL in browser , then app is saying Some thing has broken,intimated to admin. The app worked fine before few hours, but what happened after few hours.

I just pushed my old DB backup to Heroku DB, Thats it app running fine now.

But I confused what happened to my app, I am facing this problem again and again, how can I avoid this problem in future.

My app configuration:

psycopg2==2.4.5
Django==1.4

Upvotes: 1

Views: 94

Answers (1)

Jody Fitzpatrick
Jody Fitzpatrick

Reputation: 357

This could be a number of causes. It sounds more like a database issue. I would run the following command

heroku pg # TAKE NOTE OF THE HEROKU_POSTGRESQL_[COLOR]_URL

heroku pg:reset HEROKU_POSTGRESQL_[COLOR]_URL --confirm [appname]

This will reset your postgres database that is the active one, remove all tables etc.

Then I would run the regular command to get your database backup and running.

manage.py syncdb

You can also do the following

manage.py validate

This will go through your modules and tell you if any errors are present.

If that fails - enable debug in your settings.py file.

Also you can run "heroku logs" this will tell you the last few errors and statuses that have been hit with your app.

Let me know if this works, if not I will help debug further.

Upvotes: 1

Related Questions