[Web-SIG] about WSGI adoption
manlio_perillo at libero.it
Sun Nov 18 22:56:01 CET 2007
Titus Brown ha scritto:
> On Sun, Nov 18, 2007 at 09:03:23PM +0100, Manlio Perillo wrote:
> -> Titus Brown ha scritto:
> -> > ->
> -> > -> However I still consider remarkable that there is not a "trac.wsgi" script.
> -> > -> Can this be caused by the lack of a standardized deployment of WSGI
> -> > -> applications?
> -> >
> -> > What would a trac.wsgi script contain?
> -> import trac.web.main
> -> application = trac.web.main.dispatch_request
> So this is something that can be 'execfile'd, I guess...
It provides an application callable that the WSGI gateway/server can
> -> > WSGI is a programming interface,
> -> > not a script interface like CGI.
> -> Right, but a WSGI server/gateway just needs a simple script to execute
> -> the WSGI application.
> That might be useful for some WSGI deployment techniques and less useful
> for others. For example, if you're using an SCGI-based WSGI server, you
> need a command-line executable;
This is not fully correct.
The sample script I have posted can be used by a SCGI-based WSGI server too.
I think that the "deployment" must be done by the WSGI gateway/server
and not by the application.
That is, the "application" should only expose the callable object, and
should not "start a server", opening logging and configuration files, or
> for mod_python, you probably need an
> importable module with a function; for CGI, you need a CGI script; etc.
> So I think you're talking about something that is very specific to your
> own deployment technique. This is out of the scope of the WSGI
> proposal, for good reasons -- there are many ways of configuring and
> deploying WSGI apps and I don't know that we've settled on only one way.
But in the WSGI spec there is a propose to standardize a deployment method.
As an example, WSGI says nothing about what happens when an application
module is imported (and the Python application process is created).
It can be useful if the gateway can execute an
function, where environment contains the same objects of the request
enviroment, excluding the HTTP headers and the input object, and with a
separate errors object.
Logging is another thing that should be clarified.
How should an application do logging?
As an example for a WSGI gateway embedded in an existing server (like
Apache and Nginx) it can be useful and convenient to keep logging in an
unique log file.
And if the server logging system uses "log levels", this should be
usable by the WSGI application.
The same is valid for application configuration.
> Paste is an effort to standardize d
eployment of WSGI applications, I
Regards Manlio Perillo
More information about the Web-SIG