forked from pahaz/Example-of-MVC-pattern-on-pure-Python-2014
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
18 lines (14 loc) · 816 Bytes
/
app.py
File metadata and controls
18 lines (14 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# This is our application object. It could have any name,
# except when using mod_wsgi where it must be "application".
# *arguments*:
# `environ` points to a dictionary containing CGI like environment variables
# which is filled by the server for each received request from the client
# `start_response` is a callback function supplied by the server
# which will be used to send the HTTP status and headers to the server
def application(environ, start_response):
response_body = 'The request ENV: {0}'.format(repr(environ))
http_status_code_and_msg = '200 OK'
response_headers = [('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body)))]
start_response(http_status_code_and_msg, response_headers)
return [response_body] # it could be any iterable.