V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
h19981126g
V2EX  ›  问与答

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

  •  
  •   h19981126g · 2018-08-15 22:22:16 +08:00 · 2170 次点击
    这是一个创建于 2052 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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
    请求我该怎么做?解决必有感谢
    7 条回复    2018-08-16 11:32:00 +08:00
    0vels
        1
    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
        2
    h19981126g  
    OP
       2018-08-15 22:30:52 +08:00 via Android
    @0vels 所以具体要怎么做呢?
    Yourshell
        3
    Yourshell  
       2018-08-15 23:00:01 +08:00 via iPhone
    myself
        4
    myself  
       2018-08-15 23:06:48 +08:00 via Android
    新手回答。这个报错,到底涉及到几个程序变量?跟 web 服务器有没有关系?网关有没有装好?代码有没有问题?网关运行的时候,这个参数的写法,是不是官方出的?找到网关的配置官方指导。复制报错信息,到谷歌搜索。
    因为是语音输入,所以尽量避免英文
    0xABCD
        5
    0xABCD  
       2018-08-16 00:20:30 +08:00 via Android
    你没有贴代码文件目录结构,不过目测原因是:index 是一个目录,但是这个目录下没有__init__.py 这个文件,导致找不到这个包,你加上试试
    h19981126g
        6
    h19981126g  
    OP
       2018-08-16 09:54:45 +08:00
    @0xABCD 好像没用唉,我直接 python 运行 index.py 就出现了 403 拒绝
    @myself
    @Yourshell
    @0vels
    myself
        7
    myself  
       2018-08-16 11:32:00 +08:00 via Android
    @h19981126g 你有这个文件吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1006 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 66ms · UTC 22:01 · PVG 06:01 · LAX 15:01 · JFK 18:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.