Created
April 8, 2013 21:52
-
-
Save yuuichi-fujioka/5340863 to your computer and use it in GitHub Desktop.
8080ポートで受け付け、必ずHello Worldを返すwsgiアプリ
http server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wsgiref import simple_server | |
class Main(object): | |
def __call__(self, environ, start_response): | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
return 'Hello World' | |
if __name__ == '__main__': | |
server = simple_server.make_server('', 8080, Main()) | |
server.serve_forever() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
from eventlet import wsgi | |
def app(env, start_response): | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
return 'Egg' | |
def main(): | |
wsgi.server(eventlet.listen(('', 8080)), app) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment