uwsgi和bottle中存在一个文件,但发生404错误

时间:2018-04-28 05:09:24

标签: python nginx uwsgi bottle

文件组织

  

·/ hoge/1/a/bottle.py·/ hoge / 1 / a / hoge.py·/ hoge / 1 / a /hoge.ini

/hoge/1/a.py屏幕上显示错误显示内容

   Error: 404 Not Found
    Sorry, the requested URL 'http://example.com/hoge/1/a.py' caused an error:

    Not found: '/hoge/1/a.py'

/hoge/1/a.py

#!/usr/bin/python3.6 python
# -*- coding:utf-8 -*-
from bottle import route, run, default_app

@route('/')
def index():
    return "Hello World!"

application = default_app()

/hoge/1/a.ini

[uwsgi]
uid = nginx
gid = nginx
socket = /var/run/uwsgi/app/%n.sock
chmod-socket = 777
chdir = /var/www/example.com/hoge/1
wsgi-file = /var/www/example.com/hoge/1/%n.py
file         = %n.py
processes = 4
threads = 2

a.ini日志

announcing my loyalty to the Emperor...

1 个答案:

答案 0 :(得分:1)

这是因为只提供与已为其设置的@route之一匹配的网址。在这种情况下,设置的唯一路线是/,因此只有http://example.com/才有效。