首页 文章

外部访问时Python瓶问题

提问于
浏览
1

所以我使用python的bottle模块来监听我的服务器上的请求 . 我已经在本地完成了所有测试,现在已经到了部署时间,我无法让它在我的服务器上运行 .

from bottle import route, get, post, request, Bottle, run, template

@route('/Request/<UniqueID>') #Build Temporary Webpage
def login_form(UniqueID):
    return '''<form method="POST" action="/SLR_Creation">
                ID: <input name="UID" type="text" value="''' +UniqueID+ '''" />
Scale: <input name="Scale" type="text" value="10000"/>
<input type="submit" value="CLick here to create report"/> </form>''' @route('/<UniqueID>', method='POST') # Return def PHPH_Script(UniqueID): # Big long script to create a report return '''<p>The report has been created. Click this button to access it.
</p> <form action="''' + WebLocation +'''.html"> <input type="submit" value="CLick here to access report"> </form>''' # Create and Run Page #run(host='localhost', port=8080) run(host='12.34.255.89', port=80) # This is not my actually IP Address.

现在最后一行代码不断给我一个错误: error: [Errno 10049] The requested address is not valid in its context. 现在,如果我使用注释掉的行,它就像一个魅力 .

我知道我的IP是正确的,端口是开放的,所以有人知道我的问题在这里吗?

1 回答

  • 1

    也许有几个问题:

    • 端口80可能正在被另一个任务使用,即使它崩溃了 .

    • 如果您使用说端口8080,则必须使用

    http://12.34.255.89:8080/Request/...

    • method='POST' 可能会遇到保护问题,并且在某些情况下会变得不可靠 .

    • 看到路线匹配包括像 .html 这样的东西

相关问题