import eventlet | |
from eventlet import wsgi | |
import os.path | |
upload_dir = '/home/uploads/' | |
def application(environ, start_response): | |
path = environ['PATH_INFO'] | |
if not os.path.isfile(upload_dir + path): | |
start_response("404 Not Found", [('Content-type', 'text/plain')]) | |
return [''] | |
file = open(upload_dir + path) | |
body = file.read() | |
start_response('200 OK', [('Content-Type', 'image/jpeg')]) | |
return [body] | |
wsgi.server(eventlet.listen(('', 8080)), application, log_output=None, debug=False, max_size=10000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment