我有一个将其配置为python模块的烧瓶应用程序。
为了进一步解释,这是我的项目的一个简化结构:
project_dir
ven
dir_a
dir_b
flask_app
__init__.py
__main__.py# __main__.py
.
.
.
app = create_app(...)
client = Client(app)
.
.
.
print("Hello World")
running_app = app.run("0.0.0.0", port=5000)当我想运行我的应用程序时,我点击了python -m dir_a.dir_b.flask_app
现在我想用火绒角来管理它。
供您参考,这是一个运行gunicorn的示例。
gunicorn -w 1 -b 0.0.0.0:5000 **wsgi:server**如果我想运行应用程序,则从project_dir运行
python -m dir_a.dir_b.flask_app
在我的案子里,我该如何用金角来处理我的申请呢?
请注意,我希望在运行应用程序之前打印"Hello“
我试过的是:
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:running_app然后,我删除了行running_app = app.run("0.0.0.0", port=5000),并尝试
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:app和
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:create_app(...)他们都不管用
发布于 2021-12-16 22:27:31
你需要告诉君之角该运行哪个应用程序
app.run()方法是用于开发服务器的,所以首先您必须注释掉它,或者直接删除它。
然后
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:app或者您可以将应用程序导入到模块的更高的位置。
https://stackoverflow.com/questions/70386205
复制相似问题