Created
January 28, 2016 22:58
-
-
Save bmsleight/bc34254eed0ee458738e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import BaseHTTPServer | |
from os import environ | |
def test(HandlerClass=SimpleHTTPRequestHandler, | |
ServerClass=BaseHTTPServer.HTTPServer): | |
protocol = "HTTP/1.0" | |
host = environ.get('OPENSHIFT_PYTHON_IP') | |
port = int(environ.get('OPENSHIFT_PYTHON_PORT')) | |
server_address = (host, port) | |
HandlerClass.protocol_version = protocol | |
httpd = ServerClass(server_address, HandlerClass) | |
sa = httpd.socket.getsockname() | |
print "Serving HTTP on", sa[0], "port", sa[1], "..." | |
httpd.serve_forever() | |
if __name__ == "__main__": | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment