uwsgi flask服务器总是返回'Hello World!'

问题描述 投票:0回答:1

我按照此tutorial配置nginx和uwsgi。

这是我的/etc/nginx/sites-available/myprojetc内容:

server {
    listen 80;
    server_name 10.x.x.my_server_ip;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/home/myname/myproject/myproject.sock;
    }
}

现在,我可以在笔记本电脑的浏览器中访问10.x.x.my_server_ip。它显示了我:Hello World!

但是myproject.py是:

from flask import Flask

application = Flask(__name__)


@application.route('/')
def hello_world():
    return 'Hello There'

if __name__ == "__main__":
    application.run(host='0.0.0.0')

如您所见,它应该返回Hello There。谁能告诉我我的配置出了什么问题?如果您需要更多信息,可以发表评论。

python nginx flask uwsgi
1个回答
0
投票

几天后,我找到了必须重新启动uwsgi服务而不是重新启动nginx的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.