简体   繁体   English

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

[英]A file exists in uwsgi and bottle, but a 404 error occurs

file organization 文件组织

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


/hoge/1/a.py Error displayed on the screen Display contents /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 /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 /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 log a.ini日志

announcing my loyalty to the Emperor...

This is because bottle only serves URLs which match one of the @route s that have been set up for it. 这是因为bottle只提供与@route设置的@route之一匹配的URL。 In this case the only route that is set up is / , so only http://example.com/ will work. 在这种情况下,唯一设置的路由是/ ,因此只有http://example.com/可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM