Connection refused when tryign to run bottle/flask web framweworks

dieter dieter at handshake.de
Mon Aug 20 00:58:42 EDT 2018


Νίκος <nikos.at.superhost at gmail.com> writes:
> i just installed bottle and flask web frameworks in my CentOS environment but i canno get it working even with the simpleste xample. The coonection is refused always.

"connection refused" is an indication that there is no (running)
server at the connection port.

Unlike simple web servers, more complex web frameworks are often not
started automatically at system startup (as they require complex
configuration to be meaningfully usable). Likely, this your
case: you likely need to explicitely start the server component.

> from bottle import route, run, template
>
> @route('/hello/<name>')
> def index(name):
>     return template('<b>Hello {{name}}</b>!', name=name)
>
> run(host='localhost', port=8080)

Likely, the code above is supposed to start the server component.
Ensure, that the start is successful (I typically use "lsof -i"
to find out whether a server is listening on the expected port).




More information about the Python-list mailing list