if __name__ == '__main__':
    server_address = '', 8000
httpd = CGIHTTPServer.BaseHTTPServer.HTTPServer(server_address,
    MyRequestHandler)
try:
    httpd.serve_forever()
except KeyboardInterrupt:
    sys.exit()
Глобальная переменная на сервере Python