我在这里关注heroku快速入门指南: https://devcenter.heroku.com/articles/getting-started-with-python
我被困在工头开始部分。这是我的目录所看到的。我只是运行一个基本的网络应用程序。没有框架或任何东西。
soapbar/
Procfile.txt
soapbar/
soapbar.py
venv/
Include/
Lib/
Scripts/
这是堆栈跟踪:
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
有什么想法吗?
答案 0 :(得分:3)
将名为__init__.py
的文件添加到soapbar/
文件夹。把它留空。
需要
__init__.py
个文件才能让Python对待 目录包含包;这是为了防止 无意中具有通用名称的目录,例如string 隐藏稍后在模块搜索路径上发生的有效模块。在 最简单的情况,__init__.py
可以只是一个空文件,但它可以 还执行包的初始化代码或设置__all__
变量