Issue
Is there a way to programatically find out which PORT Apache is running on from within a Python program (WEB Application using mod_wsgi)
I can always do a grep on httpd.conf but wanted to know if there is some other standard programatic way of achieving this.
Solution
Environment variable SERVER_PORT should give it to you:
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [ env['SERVER_PORT'] ]
Answered By - user447688