Can't figure out how to get my python server to respond to requests
6 replies, posted
So I wrote a python server that listens for GET and POST requests
But no matter what I do, I just cant seem to make it listen publicly, its on a publically accessible server hosting a website and its supposed to function as a database system and control system for a video game community. Either I got the address wrong, or the file is in the wrong folder, or the python code is not working, but that is for another thread.
How do I find the actual URL/address of my server so I can send requests to it straight from another page on the same server?
You should probably start with checking to which IP/Port your program binds. On Windows you can run netstat -a -b in a command prompt, on Linux you can use netstat -lnp.
There might be a chance you're binding to a local ip and not a public one (or bind to 0.0.0.0 which should bind to all available IP's (on Linux at least, not sure about Windows). If your program doesn't show up at all something else is probably wrong. Would probably help if you post a part of your code and tell which platform you're hosting on.
Hosting it on linux CentOS I think, its packman is yum.
How do I bind to 0.0.0.0? I know jackshit about networking.
Since it's a closed source commercial product I suggest you read the documentation on how to bind to a specific ip address. All I can think of now that might be causing issues is if the process isn't running as the root user,s only the root user can bind to port range 0-1000, anything above is available for nonroot users.
So your python server is probably listening on a specific port on localhost.
You'll probably want a reverse-proxy (Nginx is a good choice) to redirect all HTTP(S) traffic from port 80/443 to it.
Google Python reverse proxy nginx or similar.
Thanks guys
Figure out Flask is good for binding to 0.0.0.0
Sorry, you need to Log In to post a reply to this thread.