BasicHTTPServer, SimpleHTTPServer and concurrency
Posted
by braindump
on Stack Overflow
See other posts from Stack Overflow
or by braindump
Published on 2010-03-16T15:21:26Z
Indexed on
2010/03/16
15:41 UTC
Read the original article
Hit count: 606
I'm writing a small web server for testing purposes using python, BasicHTTPServer and SimpleHTTPServer. It looks like it's processing one request at a time. Is there any way to make it a little faster without messing around too deeply? Basicly my code looks as the following and I'd like to keep it this simple ;)
os.chdir(webroot)
httpd = BaseHTTPServer.HTTPServer(("", port), SimpleHTTPServer.SimpleHTTPRequestHandler)
print("Serving directory %s on port %i" %(webroot, port) )
try:
httpd.serve_forever()
except KeyboardInterrupt:
print("Server stopped.")
© Stack Overflow or respective owner