Issues with Python bottle when accessing from outside

So, I am using the bottle module for python to listen for requests on my server. I checked all the tests locally, and now that the time has come for deployment, I cannot get it to work on my server.

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+ '''" /><br /> Scale: <input name="Scale" type="text" value="10000"/><br /> <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.<br /></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. 

Now that the last line of code is causing an error: error: [Errno 10049] The requested address is not valid in its context. Now, if I use a commented line, it works like a charm.

I know that my IP address is correct and the port is open, so can anyone understand that my problem is here?

+1
source share
1 answer

Perhaps a few questions:

  • port 80 can be used by another task, even if it crashed.

  • If you use say port 8080, you should use

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

  • method='POST' may encounter security issues and be unreliable in some cases.

  • See that the route matches things like .html

+1
source

All Articles