简体   繁体   English

Bottle.py服务器有时即使存在路由也拒绝连接或给出404

[英]Bottle.py server sometimes refusing connections, or giving 404, even when route exists

Im having some issues with my Bottle server, which at this point is little more than a basic account management service. 我的Bottle服务器出现了一些问题,到目前为止,这仅是基本的帐户管理服务。 It worked fine when I was on my own machine, but when I uploaded it to my VPS it just doesnt want to work. 当我在自己的计算机上时,它工作正常,但是当我将其上传到VPS时,它只是不想工作。 When I try to access routes (for example /acc/ ), it sometimes either gives a 404 not found error, or a connection refused error, or actually works. 当我尝试访问路由(例如/acc/ )时,有时会给出404 not found错误,或者连接被拒绝错误,或者可以正常工作。

I did move from windows to ubuntu 16.04 (my machine to vps), I dont know if thats relevant. 我确实从Windows移至ubuntu 16.04(我的机器移至VPS),我不知道这是否相关。

You can view my full python code here: https://pastebin.com/SDUhQ92X 您可以在这里查看我的完整python代码: https//pastebin.com/SDUhQ92X

However, this is a minimal version with all the routes except one removed: 但是,这是一个最低版本,其中除一条路由外,所有路由均被删除:

#import shelve
#import json
from bottle import route, run, static_file
#from createuser import create_user

@route('/acc/')
def server_static():
    return static_file('home.html', r'/lemonde/accountmanagement')

run(host='0.0.0.0', port=80)

I dont get any error messages in console, just 404 when it doesnt work. 我在控制台中没有收到任何错误消息,只有404错误时才收到。

Its live for you to see at 158.69.185:80/acc if you want to check yourself. 如果您想检查一下自己,它的实时显示为158.69.185:80/acc

问题在于/acc并非另存为/acc/ ,这是@Jonathon Reinhart建议的

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

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