[newbie] Equivalent to PHP?

Chris Angelico rosuav at gmail.com
Wed Jun 13 05:41:41 EDT 2012


On Wed, Jun 13, 2012 at 7:25 PM, Gilles <nospam at nospam.com> wrote:
> I have a couple more questions:
>
> 1. Today what is the recommended way to connect a long-running Python
> web application with a web server running in the front? FastCGI? WSGI?
> Other?
>
> 2. Which solid web server is recommended to connect to Python web
> applications in the back?
>
> 3. What Python web framework would you recommend to get started, and
> possibly more heavy duty framework in case I need something bigger
> later?

There are quite a few Python web frameworks, but I've never used any.
What I have done, though, is subclass
BaseHTTPServer.BaseHTTPRequestHandler, override do_GET(self), and run
a core loop with a single line of code (well, there's a little more so
the server can be halted cleanly with Ctrl-C, but close enough). And
it runs beautifully on Windows and Linux, and would probably run on
any other platform with a Python, if anyone felt like trying.it.
However, there are times when you need a little more organization, and
I don't know how easy it is to minimize downtime when you need to
update code (with this particular example, I just restart it and have
a couple of minutes' outage, which isn't an issue).

For high-availability servers, I can't speak for Python, as I've never
done that there; but it seems likely that there's good facilities. My
personal preference is Pike, but that's off-topic for this list. :)
But the simple answer for simple tasks is: Don't bother with
frameworks, run an HTTP server.

Chris Angelico



More information about the Python-list mailing list