Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
gevent
Commits
405d689c
Commit
405d689c
authored
15 years ago
by
Denis Bilenko
Browse files
Options
Download
Email Patches
Plain Diff
update examples/wsgiserver.py to use wsgi2
parent
92f03301
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
examples/wsgiserver.py
examples/wsgiserver.py
+10
-11
No files found.
examples/wsgiserver.py
100644 → 100755
View file @
405d689c
"""This is a simple example of running a wsgi application with gevent.
For a more fully-featured server which supports multiple processes,
multiple threads, and graceful code reloading, see:
http://pypi.python.org/pypi/Spawning/
#/usr/bin/python
"""Simple wsgi app. Serving on 8088.
"""
from
gevent
import
wsgi
,
socket
from
gevent
import
wsgi2
def
hello_world
(
env
,
start_response
):
if
env
[
'PATH_INFO'
]
!=
'/'
:
start_response
(
'404 Not Found'
,
[(
'Content-Type'
,
'text/plain'
)])
return
[
'Not Found
\r\n
'
]
else
:
if
env
[
'PATH_INFO'
]
==
'/'
:
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
return
[
"Hello World!
\r\n
"
]
else
:
start_response
(
'404 Not Found'
,
[(
'Content-Type'
,
'text/plain'
)])
return
[
'Not Found
\r\n
'
]
wsgi
.
server
(
socket
.
tcp_listener
((
''
,
8080
)),
hello_world
)
print
__doc__
wsgi2
.
WSGIServer
((
''
,
8088
),
hello_world
).
serve_forever
()
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment