1

I'm following the heroku quick start guide here: https://devcenter.heroku.com/articles/getting-started-with-python

and I'm stuck on the foreman start part. This is what my directory looks. I'm just running a basic web app. No frameworks or anything.

soapbar/
    Procfile.txt
    soapbar/
        soapbar.py
    venv/
        Include/
        Lib/
        Scripts/ 

This is the stack trace:

16:00:13 web.1  | started with pid 34135
16:00:13 web.1  | 2014-03-19 16:00:13 [34135] [INFO] Starting gunicorn 18.0    
16:00:13 web.1  | 2014-03-19 16:00:13 [34135] [INFO] Listening at: http://0.0.0.0:5000 (34135)
16:00:13 web.1  | 2014-03-19 16:00:13 [34135] [INFO] Using worker: sync
16:00:13 web.1  | 2014-03-19 16:00:13 [34138] [INFO] Booting worker with pid: 34138
16:00:13 web.1  | 2014-03-19 16:00:13 [34138] [ERROR] Exception in worker process:
16:00:13 web.1  | Traceback (most recent call last):
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
16:00:13 web.1  |     worker.init_process()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
16:00:13 web.1  |     self.wsgi = self.app.wsgi()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
16:00:13 web.1  |     self.callable = self.load()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
16:00:13 web.1  |     return self.load_wsgiapp()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
16:00:13 web.1  |     return util.import_app(self.app_uri)
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
16:00:13 web.1  |     __import__(module)
16:00:13 web.1  | ImportError: No module named soapbar
16:00:13 web.1  | Traceback (most recent call last):
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
16:00:13 web.1  |     worker.init_process()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
16:00:13 web.1  |     self.wsgi = self.app.wsgi()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
16:00:13 web.1  |     self.callable = self.load()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
16:00:13 web.1  |     return self.load_wsgiapp()
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
16:00:13 web.1  |     return util.import_app(self.app_uri)
16:00:13 web.1  |   File "/Users/ranuka/soapbar/venv/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
16:00:13 web.1  |     __import__(module)
16:00:13 web.1  | ImportError: No module named soapbar
16:00:13 web.1  | 2014-03-19 16:00:13 [34138] [INFO] Worker exiting (pid: 34138)
16:00:13 web.1  | 2014-03-19 16:00:13 [34135] [INFO] Shutting down: Master
16:00:13 web.1  | 2014-03-19 16:00:13 [34135] [INFO] Reason: Worker failed to boot.
16:00:13 web.1  | exited with code 3
16:00:13 system | sending SIGTERM to all processes
SIGTERM received

Any ideas?

user2769651
  • 171
  • 1
  • 3
  • 15

1 Answers1

3

Add a file named __init__.py to the soapbar/ folder. Leave it empty.

The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string, from unintentionally hiding valid modules that occur later on the module search path. In the simplest case, __init__.py can just be an empty file, but it can also execute initialization code for the package or set the __all__ variable.

Source: http://docs.python.org/2/tutorial/modules.html

bosnjak
  • 8,424
  • 2
  • 21
  • 47
  • I think you meant a file named `__init__.py`. – dirn Mar 19 '14 at 20:25
  • Hi, would you know where am I supposed to stick my application? I'm getting the app failed to load, cannot find application: 'soapbar' – user2769651 Mar 20 '14 at 13:09
  • I don't understand what you mean. Can you describe what you are trying to do, and what exact error you are getting? What does it mean "stick" my application? You mean in what folder to put it? The directory tree you are using seems ok. – bosnjak Mar 20 '14 at 13:12
  • The added change I made still doesn't resolve the problem. Now I get a new error, where gunicorn cannot find my app which is soapbar.py – user2769651 Mar 20 '14 at 13:36
  • Here is the link I made a new post with the stack trace and all. http://stackoverflow.com/questions/22534552/foreman-start-failed-to-find-application-soapbar – user2769651 Mar 20 '14 at 13:36