Sebastian Bassi wrote:
On Tue, Mar 16, 2010 at 2:18 PM,  <pyt...@bdurham.com> wrote:
I have a few dozen simple Python CGI scripts.
Are there any advantages or disadvantages to rewriting these CGI scripts as
WSGI scripts?

It depends of the script. WSGI should be faster since you don't start
a Python instance for each call (as in CGI).

   It's almost always faster.  But be careful about global state.
Remember that WSGI/FCGI programs are really functions, called
over and over with a new transaction on each call.  So your
function has to be reusable.

   Things like initializing global variables at program load time,
rather than when the main function is called, may give trouble.
Also, be careful about leaving files, database connections, and
sockets open after the main function returns.

                                John Nagle
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to