1

I am getting an application error while running my django app on heroku. Here are the results from heroku logs:

2017-04-08T17:24:50.000000+00:00 app[api]: Build started by user [email protected] 2017-04-08T17:25:11.732420+00:00 app[api]: Deploy f4ef15f by user [email protected] 2017-04-08T17:25:11.732420+00:00 app[api]: Release v10 created by user [email protected] 2017-04-08T17:25:11.987358+00:00 app[api]: Release v10 created by user [email protected] 2017-04-08T17:24:50.000000+00:00 app[api]: Build succeeded 2017-04-08T17:25:12.354075+00:00 heroku[web.1]: State changed from crashed to starting 2017-04-08T17:25:18.683488+00:00 heroku[web.1]: Starting process with command `gunicorn --pythonpath expense_manager expense_manager.wsgi --log-file -` 2017-04-08T17:25:20.881565+00:00 heroku[web.1]: State changed from crashed to starting 2017-04-08T17:25:20.880602+00:00 heroku[web.1]: State changed from starting to crashed 2017-04-08T17:25:20.868145+00:00 heroku[web.1]: Process exited with status 3 2017-04-08T17:25:20.728492+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [4] [INFO] Starting gunicorn 19.7.1 2017-04-08T17:25:20.729017+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [4] [INFO] Listening at: http://0.0.0.0:38551 (4) 2017-04-08T17:25:20.729116+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [4] [INFO] Using worker: sync 2017-04-08T17:25:20.732466+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [8] [INFO] Booting worker with pid: 8 2017-04-08T17:25:20.736689+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [8] [ERROR] Exception in worker process 2017-04-08T17:25:20.736693+00:00 app[web.1]: Traceback (most recent call last): 2017-04-08T17:25:20.736694+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker 2017-04-08T17:25:20.736695+00:00 app[web.1]: worker.init_process() 2017-04-08T17:25:20.736696+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process 2017-04-08T17:25:20.736697+00:00 app[web.1]: self.load_wsgi() 2017-04-08T17:25:20.736699+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi 2017-04-08T17:25:20.736697+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi 2017-04-08T17:25:20.736698+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2017-04-08T17:25:20.736700+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2017-04-08T17:25:20.736699+00:00 app[web.1]: self.callable = self.load() 2017-04-08T17:25:20.736701+00:00 app[web.1]: return self.load_wsgiapp() 2017-04-08T17:25:20.736701+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2017-04-08T17:25:20.736703+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app 2017-04-08T17:25:20.736702+00:00 app[web.1]: return util.import_app(self.app_uri) 2017-04-08T17:25:20.736703+00:00 app[web.1]: __import__(module) 2017-04-08T17:25:20.736704+00:00 app[web.1]: ImportError: No module named 'expense_manager.wsgi' 2017-04-08T17:25:20.736798+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [8] [INFO] Worker exiting (pid: 8) 2017-04-08T17:25:20.780458+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [4] [INFO] Shutting down: Master 2017-04-08T17:25:20.780489+00:00 app[web.1]: [2017-04-08 17:25:20 +0000] [4] [INFO] Reason: Worker failed to boot. 2017-04-08T17:25:25.419069+00:00 heroku[web.1]: Starting process with command `gunicorn --pythonpath expense_manager expense_manager.wsgi --log-file -` 2017-04-08T17:25:27.653789+00:00 heroku[web.1]: Process exited with status 3 2017-04-08T17:25:27.664966+00:00 heroku[web.1]: State changed from starting to crashed 2017-04-08T17:25:27.418329+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [4] [INFO] Starting gunicorn 19.7.1 2017-04-08T17:25:27.428032+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi 2017-04-08T17:25:27.428038+00:00 app[web.1]: ImportError: No module named 'expense_manager.wsgi' 2017-04-08T17:25:27.465402+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2017-04-08T17:25:27.418976+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [4] [INFO] Using worker: sync 2017-04-08T17:25:27.428033+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2017-04-08T17:25:27.428182+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [8] [INFO] Worker exiting (pid: 8) 2017-04-08T17:25:27.465402+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi 2017-04-08T17:25:27.422342+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [8] [INFO] Booting worker with pid: 8 2017-04-08T17:25:27.428033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi 2017-04-08T17:25:27.460499+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [9] [INFO] Booting worker with pid: 9 2017-04-08T17:25:27.465403+00:00 app[web.1]: self.callable = self.load() 2017-04-08T17:25:27.568119+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [4] [INFO] Reason: Worker failed to boot. 2017-04-08T17:25:27.418827+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [4] [INFO] Listening at: http://0.0.0.0:3650 (4) 2017-04-08T17:25:27.428033+00:00 app[web.1]: self.callable = self.load() 2017-04-08T17:25:27.465397+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [9] [ERROR] Exception in worker process 2017-04-08T17:25:27.465403+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2017-04-08T17:25:27.428028+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [8] [ERROR] Exception in worker process 2017-04-08T17:25:27.428034+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2017-04-08T17:25:27.465398+00:00 app[web.1]: Traceback (most recent call last): 2017-04-08T17:25:27.465404+00:00 app[web.1]: return self.load_wsgiapp() 2017-04-08T17:25:27.428030+00:00 app[web.1]: Traceback (most recent call last): 2017-04-08T17:25:27.428034+00:00 app[web.1]: return self.load_wsgiapp() 2017-04-08T17:25:27.465399+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker 2017-04-08T17:25:27.465404+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2017-04-08T17:25:27.428031+00:00 app[web.1]: worker.init_process() 2017-04-08T17:25:27.428036+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app 2017-04-08T17:25:27.465401+00:00 app[web.1]: self.load_wsgi() 2017-04-08T17:25:27.465405+00:00 app[web.1]: __import__(module) 2017-04-08T17:25:27.428032+00:00 app[web.1]: self.load_wsgi() 2017-04-08T17:25:27.428036+00:00 app[web.1]: __import__(module) 2017-04-08T17:25:27.465401+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi 2017-04-08T17:25:27.465408+00:00 app[web.1]: ImportError: No module named 'expense_manager.wsgi' 2017-04-08T17:25:27.428030+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker 2017-04-08T17:25:27.428035+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2017-04-08T17:25:27.465400+00:00 app[web.1]: worker.init_process() 2017-04-08T17:25:27.465404+00:00 app[web.1]: return util.import_app(self.app_uri) 2017-04-08T17:25:27.428031+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process 2017-04-08T17:25:27.428035+00:00 app[web.1]: return util.import_app(self.app_uri) 2017-04-08T17:25:27.465400+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process 2017-04-08T17:25:27.465405+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app 2017-04-08T17:25:27.465511+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [9] [INFO] Worker exiting (pid: 9) 2017-04-08T17:25:27.568035+00:00 app[web.1]: [2017-04-08 17:25:27 +0000] [4] [INFO] Shutting down: Master 2017-04-08T17:26:52.783836+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=expense-manager-django.herokuapp.com request_id=1d751f3f-b874-44d7-88f1-39996099aefa fwd="182.71.131.18" dyno= connect= service= status=503 bytes= protocol=https 2017-04-08T17:26:53.380252+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=expense-manager-django.herokuapp.com request_id=ffc9e5e0-040d-4eb7-ace9-261c42044a47 fwd="182.71.131.18" dyno= connect= service= status=503 bytes= protocol=https 

Please help! I am new to deploying projects using heroku.I really don't understand these logs, so if someone could point me in the right direction, I would be most grateful.

├── accounts │   ├── admin.py │   ├── __init__.py │   ├── migrations │   ├── models.py │   ├── __pycache__ │   ├── templates │   ├── tests.py │   ├── urls.py │   └── views.py ├── assets │   ├── css │   └── js ├── db.sqlite3 ├── expense │   ├── admin.py │   ├── __init__.py │   ├── migrations │   ├── models.py │   ├── __pycache__ │   ├── serializers.py │   ├── static │   ├── templates │   ├── tests.py │   ├── urls.py │   └── views.py ├── expense_manager │   ├── __init__.py │   ├── __pycache__ │   ├── settings.py │   ├── urls.py │   ├── views.py │   └── wsgi.py ├── manage.py ├── Procfile ├── requirements.txt ├── runtime.txt └── templates ├── base.html ├── home.html └── welcome.html 

Here, I have posted the tree as well

11
  • You almost certainly shouldn't be using that --python-path parameter. Commented Apr 8, 2017 at 18:18
  • Now it says Failed to find application: 'expense_manager' @DanielRoseman Commented Apr 8, 2017 at 18:30
  • What does your file tree look like? stackoverflow.com/a/19671818/6085135 Commented Apr 8, 2017 at 18:44
  • w - expense_manager(main project folder contains all the apps and manage.py file etc) requirements.txt Procfile runtime.txt @bren Commented Apr 8, 2017 at 18:54
  • This is the expected file structure github.com/heroku/python-getting-started maybe you can show us your file tree with tree -L 2 stackoverflow.com/questions/3455625/… Commented Apr 8, 2017 at 19:02

1 Answer 1

3

For your Procfile try:

web: gunicorn --pythonpath expense_manager wsgi 

This is essentially the equivalent of how you'd run:

python expense_manager/wsgi.py 

Gunicorn's --pythonpath argument allows you to specify a directory, package name and even module. Like this:

gunicorn --pythonpath <directory> <package>.<module> 
Sign up to request clarification or add additional context in comments.

3 Comments

Where's your .git folder located? Run ls -a Also maybe doublecheck it's not python-path
Dude you are a saviour
woohoo thanks! now let me forget about all the time i wasted before i found this!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.