[ACCEPTED]-Embedded Web Server in Python?-embeddedwebserver

Accepted answer
Score: 17

How minimalistic and for what purpose?

SimpleHTTPServer comes 3 free as part of the standard Python libraries.

If 2 you need more features, look into CherryPy or (at 1 the top end) Twisted.

Score: 5

I'm becoming a big fan of the newly released 6 circuits library. It's a component/event framework 5 that comes with a very nice set of packages 4 for creating web servers & apps. Here's 3 the simple web example from the site:

from circuits.lib.web import Server, Controller

class HelloWorld(Controller):
   def index(self):
      return "Hello World!"

server = Server(8000)
server += HelloWorld()
server.run()

Its 2 WSGI support is no more complicated than 1 that, either. Good stuff.

Score: 4

If you're doing a lot of concurrent stuff, you 1 might consider Kamaelia's HTTPServer.

Score: 3

I've found web.py pretty easy to use : http://webpy.org/

0

Score: 3

If you want to use something from the standard 23 library I would strongly recommend not using 22 SimpleHTTPServer, but instead using wsgiref.simple_server. SimpleHTTPServer 21 is awkward and a rather nonsensical way 20 to implement a web application, and while 19 raw WSGI isn't terribly easy (but certainly 18 possible), you have the option to use any 17 WSGI-based framework on top of it. Also 16 if you use wsgiref you will have the option 15 to change to a server like CherryPy later 14 (note that the server in CherryPy can be 13 used separately from the rest of the framework, and 12 you only need one file for just the server). For 11 a "real" web application CherryPy 10 has several advantages over wsgiref, but 9 for a locally hosted application it's unlikely 8 any of them will matter.

If you are making 7 a desktop application you will need to launch 6 a separate thread for either wsgiref or 5 CherryPy. If that's fine, then a WSGI-based 4 server would probably be easiest. If you 3 don't want to launch a separate thread for 2 the server then you most likely need to 1 use Twisted.

Score: 1

See the WSGI reference implementation.

0

More Related questions