blob: 56c8e9e1c8ed47d5c7eee1ef5bcac792ea8b3df7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import http.server
import logging
import os
import sys
import server
logger = logging.getLogger(__name__)
hostName = os.environ['HOST']
serverPort = int(os.environ['PORT'])
if __name__ == '__main__':
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
webServer = http.server.HTTPServer((hostName, serverPort), server.MyServer)
logger.info('Server started at http://%s:%s.' % (hostName, serverPort))
try:
webServer.serve_forever()
except KeyboardInterrupt:
pass
webServer.server_close()
conn.close()
logger.info('Server stopped.')
|