-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (19 loc) · 682 Bytes
/
main.py
File metadata and controls
28 lines (19 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from wsgiref.simple_server import make_server
__author__ = 'pahaz'
def application(environ, start_response):
assert environ.get('PATH_INFO') is not None, "environ['PATH_INFO'] is None"
status = "200 OK"
headers = [('Content-type', 'text/html; charset=utf-8')]
body = """<!DOCTYPE html>
<h1>Example-mini-application</h1>
"""
start_response(status, headers)
return [body.encode('utf-8')]
def run(host='', port=31338):
print("It's work! Visit http://{host}:{port}/".format(
host=host or 'localhost',
port=port))
httpd = make_server(host, port, application)
httpd.serve_forever()
if __name__ == "__main__":
run()