gpt4 book ai didi

python - flask + nginx + uwsgi - 找不到 Python 应用程序

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

cat/etc/nginx/sites-available/mywebsite

server {
listen 80;

server_name mywebsite;

location /static {
alias /var/www/mywebsite/static;
}

location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/website.sock;
uwsgi_param UWSGI_PYHOME /var/www/mywebsite/env;
uwsgi_param UWSGI_CHDIR /var/www/mywebsite;
uwsgi_param UWSGI_MODULE mywebsite;
uwsgi_param UWSGI_CALLABLE mywebsite;
}

error_page 404 /404.html;

}

cat/etc/uwsgi/apps-available/website.ini

[uwsgi]
plugins=python
vhost=true
socket=/tmp/website.sock

cat/var/www/mywebsite/mywebsite.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
return "It works!"

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

我正在运行 nginx,然后是 uwsgi,并且在浏览器中出现 uWSGI 错误“找不到 Python 应用程序”。

最佳答案

我在相同的配置中遇到了同样的错误,我的问题只是 uwsgi 服务没有启动。重新启动 nginx 和 uwsgi 解决了问题。

关于python - flask + nginx + uwsgi - 找不到 Python 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14278424/

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