[wsgi] Python interpreter initialization

Igor Sysoev is at rambler-co.ru
Mon Aug 20 14:41:39 MSD 2007


On Mon, Aug 20, 2007 at 02:29:19PM +0400, Igor Sysoev wrote:

> On Mon, Aug 20, 2007 at 12:15:26PM +0200, Manlio Perillo wrote:
> 
> > I need some help for the development of mod_wsgi.
> > 
> > Before using the Python C API for embedding Python code, the main 
> > interpreter must be initialized by calling
> >   Py_Initialize();
> > 
> > This function set a global context.
> 
> By the way, python is the most unsuitable language to embed in nginx - it
> has the single interpreter. That means that you could not safely reconfigure
> nginx. Even perl (unsuitable too) allows several interpreters.

I was wrong - there is Py_NewInterpreter(). So python is unsuitable
in the same degree as perl.

Anyway I do not know how to write small inlines in python with its indentions:

    server {

        location / {

            python  '
def handler(r)
    ...
    ...
    ...
    ...
';

        }
    }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list