When I'm trying to run a server in this example I can see that it runs on the correct port. However, it is not possible to reach it externally (internal server error) nor to debug it in console through common methods (can't see any output).
I'm sure the port is available and the server runs. How to fix or debug this?
from bottle import run, post, request, response, get, route
@route('/<path>', method = 'GET')
def process(path):
response.content_type = 'text/html'
return 'Hello World GET'
@route('/<path>', method = 'POST')
def process(path):
response.content_type = 'text/html'
return 'Hello World POST'
run(host='localhost', port=8000, debug=True)
The cause of this was setting host='localhost'
, which made the server inaccessible from outside and I could use only localhost
for access. Changing the declaration to host='0.0.0.0'
solved my problem.