Reputation: 127
I am very new this so I would appreciate if someone could clarify this to me.
I recently started tinkering with web apps and have a small web app that is written in python and cgi. I wanted to try bottle but i am hosting on shared server.
If I SSH to my server i am able to start :
python2.7 exi.py
exi.py:
from bottle import *
@route('/login')
def login():
return '<h1>Oh no</h1>'
if __name__ == '__main__':
run()
this gives me :
Bottle v0.13-dev server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/ Hit Ctrl-C to quit.
but if i go to $mydomain$:8080/login
it is connecting...but eventually i will get ERR_CONNECTION_TIMED_OUT
is it even possible to run my own server on these services or am I beeing too naive?
Thank you, Jakub
Upvotes: 0
Views: 382
Reputation: 16304
What you're thinking makes sense. Ignoring resource constraints, if you're already running functioning web services there, you have access enough to the machine to install software and open internet sockets for listening. You should be able to run just about anything.
What you've posted tells me 2 things though. First of all, bottle says it's running on localhost
, which is only accessible from the host itself (you can Google for more on that). But also, since you get a connection timeout instead of connection refused, I can deduce that either a local firewall, eg iptables, or a hosted firewall , eg AWS security group, is blocking inbound access to that port.
By the way, you don't need a server to test this stuff. Why not run locally? Any os can run Python. Better yet, install a virtual machine with Linux and you'll continue to improve your Unix skills. Or use docker! Linux docker hosts can run on Windows or Mac as well.
Upvotes: 1
Reputation: 3904
Bottle is only running on localhost for you, which means you can only access that server from the server itself.
Try this instead
run(host='0.0.0.0', port=8080, debug=True)
this will run it on your local IP-address which should give you access from the outside.
Upvotes: 1