gunth223 Ha
gunth223 Ha

Reputation: 155

Deploying Django app on Heroku: Error [R10]

Trying to deploy my django app on Heroku, I followed the official guide and managed to get the example 'hellodjango.app' working.

Now the next step is to deploy my own project, but doing so shows me the following error on Heroku:

Logfile:

2016-01-11T06:25:15.235676+00:00 app[web.1]: Performing system checks...
2016-01-11T06:25:15.235697+00:00 app[web.1]: 2016-01-11T06:25:15.235697+00:00 app[web.1]: 
2016-01-11T06:25:15.244321+00:00 app[web.1]: System check identified no issues (0 silenced).
2016-01-11T06:25:15.276207+00:00 app[web.1]: January 11, 2016 - 06:25:15
2016-01-11T06:25:15.276211+00:00 app[web.1]: Django version 1.8, using settings 'bittania.settings'
2016-01-11T06:25:15.276212+00:00 app[web.1]: Starting development server at http://127.0.0.1:8000/
2016-01-11T06:25:15.276213+00:00 app[web.1]: Quit the server with CONTROL-C.
2016-01-11T06:25:42.412857+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=shjdhjsd.herokuapp.com request_id=781298dc-bc3d-4ad8-8da8-1a49ffb7d983 fwd="**MYIPADDRESS**" dyno= connect= service= status=503 bytes=
2016-01-11T06:26:12.694810+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-01-11T06:26:12.694810+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-01-11T06:26:13.522957+00:00 heroku[web.1]: State changed from starting to crashed
2016-01-11T06:26:13.509271+00:00 heroku[web.1]: Process exited with status 137

I've set up a Procfile, gitignore and wsgi.py

What am I doing wrong?

EDIT

Changed Procfile to "`web: gunicorn sitename.wsgi --log-file -- . Yes this works for a new app, it shows me the Django welcome screen __> pure-depths-4933.herokuapp.com. Doing so for my old project however, gives me the same error as before.

Upvotes: 0

Views: 610

Answers (2)

Ciprian Alexandru
Ciprian Alexandru

Reputation: 91

You can install Heroku CLI. It contains a tool called "heroku local" - a cli that interacts with Procfile-based apps the same way a Heroku dyno is spinning up your app.

From the app folder, you should always try to run the app locally with

heroku local

The tool will read your Procfile and try to execute each process (practically a line in the file) and set environmental variables with the values you have set in the .env file. You can enable debugging or verbose logging. You can even get all the environmental variables of a heroku app with a command like:

heroku config --app mysuperdjango >> .env.heroku

You can copy paste anything you need to .env.

Here's a tip for Django:

DEBUG = bool("True" == os.environ.get('DEBUG', False))

This line will search for the environmental variable "DEBUG". If it does not exists, if defaults to False, but if it's 'True', the Django App will start in dev mode with debug on. So if you set in .env file "DEBUG=True" and start the app with "heroku local" command, it will start in dev mode.

Hope this helps anyone that gets here from google.


https://devcenter.heroku.com/articles/heroku-cli

https://devcenter.heroku.com/articles/config-vars

https://devcenter.heroku.com/articles/heroku-local

Upvotes: 1

Daniel Roseman
Daniel Roseman

Reputation: 599450

Nowhere in those perfectly good instructions on how to deploy to Heroku does it state to put runserver in your Procfile. You need a proper server, eg gunicorn.

Upvotes: 2

Related Questions