osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Connection refused when tryign to run bottle/flask web framweworks


On 08/20/2018 06:07 AM, ????? wrote:
> Iam trying to access the bottle web framework running on my VPS as
> 
> http://superhost.gr:8080/hello
> 
> i get connection refused

> The weird thing is that in my vps command line my hello app is in state of listening
> 
> [root at superhost public_html]# python3 app.py 
> Bottle v0.12.13 server starting up (using WSGIRefServer())...
> Listening on http://localhost:8080/
> Hit Ctrl-C to quit.
> 
> So, i wonder why the socket with port 8080 aint being displayed.

Why do you wonder?  You're using the wrong url.  The message that's
displayed when you start your mini app says it's listening on localhost,
which is 127.0.0.1.  Yet you are trying to access the url
http://superhost.gr:8080/hello, which is a completely different IP
address.

For security reasons while you're debugging and developing, most web
frameworks bind to localhost, not your public address. So you need to
access it via localhost:

http://localhost:8080/hello

If you notice, this is the exact url that your program told you it was
listening on.

It is possible to configure flask to listen on "*.*.*.*" which means
listen on all interfaces, localhost as well as the outside address.  But
this is not recommended. Instead you would publish it to the outside
world through another web server like Apache.