forked from pahaz/homework-simple-python-web-application
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
24 lines (17 loc) · 689 Bytes
/
main.py
File metadata and controls
24 lines (17 loc) · 689 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
from __future__ import unicode_literals, print_function, generators, division
__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')]
if __name__ == "__main__":
from wsgiref.simple_server import make_server
PORT = 31338
print("It's work! Visit http://localhost:{0}/".format(PORT))
HTTPD = make_server('', PORT, application)
HTTPD.serve_forever()