uwsgi配置导致500错误,提示no python application found

发布于 2022-08-25 01:48:38 字数 1578 浏览 22 评论 0

使用动态方式启用的uwsgi:

uwsgi -s /tmp/uwsgi.sock -M -p 4 -t 30 --limit-as 128 -R 10000 -d /var/log/uwsgi.log --vhost --uid www --gid www --python-autoreload 1

然后配置nginx:

server {
    listen       80;
    server_name  xxxx.com;

    location /static {
            alias /home/wwwroot/xxxx/static;
    }
    location / {
            include uwsgi_params;
            uwsgi_pass  unix:/tmp/uwsgi.sock;
            uwsgi_param UWSGI_PYHOME   /home/ENV/;
            uwsgi_param UWSGI_CHDIR    /home/wwwroot/xxxx;
            uwsgi_param UWSGI_SCRIPT   xxxx;
            uwsgi_param UWSGI_CALLABLE app;
    }
}

xxxx.py文件内容如下:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

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

错误日志提示如下:

*** Starting uWSGI 1.9.6 (32bit) on [Thu Apr 18 16:40:47 2013] ***
compiled with version: 4.4.7 on 18 April 2013 15:12:56
......
Python auto-reloader enabled
unable to load app 0 (mountpoint='xxxx.com|') (callable not found or import error)
--- no python application found, check your startup logs for errors ---
xxxx.com [pid: 2009|app: -1|req: -1/1] 101.80.87.xxx () {44 vars in 723 bytes} [Thu Apr 18 16:40:53 2013] GET / => generated 21 bytes in 107 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)
unable to load app 0 (mountpoint='xxxx.com|') (callable not found or import error)

检查了一下配置,貌似没发现什么问题。virtualenv环境使用pip安装过flask,请指教到底是哪个地方配置错误了呢?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月野兔 2022-09-01 01:48:38

servername 后边不要“/”

纵性 2022-09-01 01:48:38

检查目录权限。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文