Debian9 上部署 nginx+uwsgi+web.py 遇到了 Internal Server Error

2018-08-15 22:22:16 +08:00
 h19981126g
debian9 下 python 版本是 3.6.5,环境应该都没问题。
我的 web.py 文件大概是:
app = web.application(urls, globals())
if __name__ == "__main__":
application = app.wsgifunc()
#app.un()
nginx 的配置是(放在了 conf 末尾):
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9000;
uwsgi_param UWSGI_CHDIR /home/wwwroot/domain.com;
uwsgi_param UWSGI_SCRIPT zwu;
}
使用了 lnmp 面板
shell 里到指定目录运行 uwsgi -s 127.0.0.1:9000 -w index.py 报错了:
WSGI app 0 (mountpoint='')
直接 app.run()报错:
no app loaded. going in full dynamic mode
日志:http://www.oini.top/uwsgi-log.txt
请求我该怎么做?解决必有感谢
2181 次点击
所在节点    问与答
7 条回复
0vels
2018-08-15 22:28:40 +08:00
新手路过,感觉问题在这里 ModuleNotFoundError: No module named 'index.py';
'index' is not a package unable to load app 0 (mountpoint='') (callable not found or import error)
h19981126g
2018-08-15 22:30:52 +08:00
@0vels 所以具体要怎么做呢?
Yourshell
2018-08-15 23:00:01 +08:00
myself
2018-08-15 23:06:48 +08:00
新手回答。这个报错,到底涉及到几个程序变量?跟 web 服务器有没有关系?网关有没有装好?代码有没有问题?网关运行的时候,这个参数的写法,是不是官方出的?找到网关的配置官方指导。复制报错信息,到谷歌搜索。
因为是语音输入,所以尽量避免英文
0xABCD
2018-08-16 00:20:30 +08:00
你没有贴代码文件目录结构,不过目测原因是:index 是一个目录,但是这个目录下没有__init__.py 这个文件,导致找不到这个包,你加上试试
h19981126g
2018-08-16 09:54:45 +08:00
@0xABCD 好像没用唉,我直接 python 运行 index.py 就出现了 403 拒绝
@myself
@Yourshell
@0vels
myself
2018-08-16 11:32:00 +08:00
@h19981126g 你有这个文件吗?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/480193

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX