gpt4 book ai didi

python - foreman 未启动名为 myapp 的模块

转载 作者:行者123 更新时间:2023-11-30 23:26:27 27 4
gpt4 key购买 nike

我在这里遵循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

有什么想法吗?

最佳答案

将名为 __init__.py 的文件添加到 soapbar/ 文件夹中。将其留空。

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.

来源:http://docs.python.org/2/tutorial/modules.html

关于python - foreman 未启动名为 myapp 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22517010/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com