[Django]-Problems running `foreman start` / deploying Django app to Heroku

7👍

Figured it out while writing this question!

What I had to do was set the --pythonpath option to point to my django project root, i.e. git_root/my_django_project/.

This is what I had in my Procfile:

web: gunicorn -b 0.0.0.0:8000 --pythonpath=./my_django_project my_django_project.wsgi:application

Now it works locally:

$ foreman start
17:04:02 web.1  | started with pid 6327
17:04:02 web.1  | 2013-10-15 17:04:02 [6330] [INFO] Starting gunicorn 18.0
17:04:02 web.1  | 2013-10-15 17:04:02 [6330] [INFO] Listening at: http://0.0.0.0:8000 (6330)
17:04:02 web.1  | 2013-10-15 17:04:02 [6330] [INFO] Using worker: sync
17:04:02 web.1  | 2013-10-15 17:04:02 [6335] [INFO] Booting worker with pid: 6335
17:04:04 web.1  | 2013-10-15 17:04:04 [6330] [INFO] Handling signal: winch
17:04:04 web.1  | 2013-10-15 17:04:04 [6330] [INFO] SIGWINCH ignored. Not daemonized

And scaling web processes works now, too:

$ heroku ps:scale web=1 --app my-django-project                          
Scaling web dynos... done, now running 1

0👍

Using your first scaffolding, where your Procfile is to the same level of my_django_project. I did this:

web: cd my_django_project && gunicorn my_django_project.wsgi
–log-file –

Hope this helps.

–EDIT–

It’s better change this file with the line bellow. Make sure you are on your master branch (I struggle with heroku pushing from another branch).

web: gunicorn –pythonpath my_django_project my_django_project.wsgi –log-file –

Leave a comment