gpt4 book ai didi

python - gunicorn 无法启动 python-eve

转载 作者:太空狗 更新时间:2023-10-30 01:00:22 24 4
gpt4 key购买 nike

这里是settings.py

root@00d72ee95c2d:/var/www/eve-auth# cat settings.py
DOMAIN = {'people': {}}

这是 run.py

from eve import Eve
app = Eve()

if __name__ == '__main__':
app.run()

它在我独立运行时有效:

root@00d72ee95c2d:/var/www/eve-auth# python run.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

但是当我通过 gunicorn 启动它时无法运行:

root@00d72ee95c2d:/var/www/eve-auth# gunicorn -b 0.0.0.0:5000 run:app
[2016-02-12 02:07:22 +0000] [20] [INFO] Starting gunicorn 19.4.5
[2016-02-12 02:07:22 +0000] [20] [INFO] Listening at: http://0.0.0.0:5000 (20)
[2016-02-12 02:07:22 +0000] [20] [INFO] Using worker: sync
[2016-02-12 02:07:22 +0000] [23] [INFO] Booting worker with pid: 23
[2016-02-12 02:07:22 +0000] [23] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 246, in validate_domain_struct
domain = self.config['DOMAIN']
KeyError: 'DOMAIN'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.5/site-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.5/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.5/site-packages/gunicorn/util.py", line 357, in import_app
__import__(module)
File "/var/www/eve-auth/run.py", line 2, in <module>
app = Eve()
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 135, in __init__
self.validate_domain_struct()
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 248, in validate_domain_struct
raise ConfigException('DOMAIN dictionary missing or wrong.')
eve.exceptions.ConfigException: DOMAIN dictionary missing or wrong.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 246, in validate_domain_struct
domain = self.config['DOMAIN']
KeyError: 'DOMAIN'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.5/site-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.5/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.5/site-packages/gunicorn/util.py", line 357, in import_app
__import__(module)
File "/var/www/eve-auth/run.py", line 2, in <module>
app = Eve()
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 135, in __init__
self.validate_domain_struct()
File "/usr/local/lib/python3.5/site-packages/eve/flaskapp.py", line 248, in validate_domain_struct
raise ConfigException('DOMAIN dictionary missing or wrong.')
eve.exceptions.ConfigException: DOMAIN dictionary missing or wrong.
[2016-02-12 02:07:22 +0000] [23] [INFO] Worker exiting (pid: 23)
[2016-02-12 02:07:22 +0000] [20] [INFO] Shutting down: Master
[2016-02-12 02:07:22 +0000] [20] [INFO] Reason: Worker failed to boot.

我找不到任何关于 gunicorn 和 python-eve 的文档...所以我不确定从这里挖掘哪里。

最佳答案

我从未在 Gunicorn 上运行过 Eve。然而,Eve 是 Fl​​ask 的子类,大多数适用于 Flask 的东西也适用于 Eve。

根据 Flask documentation你像这样在 Gunicorn 上运行 Flask/Eve:

gunicorn myproject:app

希望这对您有所帮助。

关于python - gunicorn 无法启动 python-eve,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35353639/

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