gpt4 book ai didi

python - 在 Ubuntu 上使用 Flask 运行 uwsgi 时出错

转载 作者:行者123 更新时间:2023-12-04 19:14:37 24 4
gpt4 key购买 nike

我无法在 DigitalOcean 上设置我的项目。我是 Python 新手。
目前正在使用 flask 创建一个简单的应用程序。

我在 ubuntu 服务器中的目录是这样的:
~/kaboong/{{所有文件}}

主 py 文件称为 main.py:

from flask import Flask, render_template, request, redirect,jsonify, url_for, flash
app = Flask(__name__)

if __name__ == '__main__':
app.debug = True
app.run(host = '0.0.0.0', port = 8000)

在我的 wsgi.py 文件中:
from main import app
if __name__ == '__main__':
app.run()

我尝试这样运行wsgi:
uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi

我收到一条错误消息:

* 未加载任何应用程序。进入全动态模式 *

这里有什么问题?

最佳答案

你能试试这个吗?

uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi:app --callable app

如果不起作用,您能否显示更多信息,例如日志控制台已满?

关于python - 在 Ubuntu 上使用 Flask 运行 uwsgi 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43043685/

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