How can I get the PORT number when using Nginx + Tornado?
Each of these ports is a different python process, right? At some point you must be passing in the port number to each process and calling app.listen(port) (or one of the related bind/listen methods). Just save the port number at that time (could just be a global variable if you only have one server per process)
Nginx make PORT 8000:8003 to Tornado server.py
I want to get the PORT number in MainHanlder and print it in the browser when someone visit my site.
And I don't want to make several copies of server.py to server8000.py, server8001.py, ..., I want just one main entrance to solve this problem.
How can I do it?