Last active
December 17, 2015 06:19
-
-
Save cdent/5564147 to your computer and use it in GitHub Desktop.
Quick and dirty wsgiref server for use with [tsapp](http://tsapp.tiddlyspace.com) as an example of using a different server than the built in cherrypy server. This one is likely to be quite slow due to its single process/thread nature. To use set `wsgi_server: wsgirefserver` in `.tsapp`.
This file contains 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 sys | |
from tsapp.proxy import create_app | |
from wsgiref.simple_server import make_server | |
def start_server(config): | |
port = int(config['port']) | |
local_host = config['local_host'] | |
httpd = make_server(local_host, port, create_app(config)) | |
try: | |
httpd.server_forever() | |
except KeyboardInterrupt: | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a typo on line 14 - it should be
httpd.serve_forever()