gpt4 book ai didi

python - web.py + uwsgi + nginx 未找到应用程序

转载 作者:行者123 更新时间:2023-11-30 23:22:38 25 4
gpt4 key购买 nike

我正在尝试部署 nginx uwsgi 和 web.py

这是我在/www/python/testme/中的index.py

import web

urls = (
'/', 'index'
)

app = web.application(urls, globals())

class index:
def GET(self):
return "Hello, world!"

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

application = app.wsgifunc

这是我的带有 uwsgi 的 nginx 配置

/etc/nginx/sites-available/python
server {
listen 8080;
server_name $hostname;
access_log /www/python/testme/logs/access.log;
error_log /www/python/testme/logs/error.log;

location / {
#uwsgi_pass 127.0.0.1:9001;
uwsgi_pass unix:///tmp/test.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}


}

/etc/uwsgi/app-available/testme.ini 中的 Uwsgi ini

[uwsgi]
gid = www-data
uid = www-data
logdate = true
logto = /var/log/uwsgi/testme.log
socket = /tmp/test.socket
#socket = 127.0.0.1:3031
master = true
plugins = python

我的 uwsgi 服务正在运行,并且 nginx 正在按预期监听端口 8080。

当我从浏览器访问我的域时,这里出现错误日志:/var/log/uwsgi/testme.log

ImportError: No module named index
Wed Jun 25 19:14:54 2014 - unable to load app 0 (mountpoint='') (callable not found or import error)
Wed Jun 25 19:14:54 2014 - --- no python application found, check your startup logs for errors ---
[pid: 32604|app: -1|req: -1/5] 46.197.209.106 () {48 vars in 919 bytes} [Wed Jun 25 19:14:54 2014] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)
ImportError: No module named index
Wed Jun 25 19:14:54 2014 - unable to load app 0 (mountpoint='') (callable not found or import error)
Wed Jun 25 19:14:54 2014 - --- no python application found, check your startup logs for errors ---
[pid: 32604|app: -1|req: -1/6] 46.197.209.106 () {46 vars in 839 bytes} [Wed Jun 25 19:14:54 2014] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)

最佳答案

至少,这是错误的——您指定了 2 个不同的套接字

你的uwsgi配置:

socket = /tmp/testme.socket

你的nginx:

uwsgi_pass      unix:///tmp/test.socket

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

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