Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
405d689c
Commit
405d689c
authored
Sep 08, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
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
()
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