[mod_python] preloading modules

Gregory (Grisha) Trubetskoy grisha at modpython.org
Thu Nov 1 21:07:29 EST 2001


You might try forcing everything to run under the main insterpreter by
sticking

PythonInterpreter main_interpreter

somehwere in httpd.conf. This way PythonImport (which only runs under main
insterpreter) and everything else will run in one interpreter and you
should see the connections (may be).

PythonImport is a flaky directive for a couple of reasons. First, there is
the subinterpreter problem. Second, the apache startup is a bit more
complicated than one may think, at the time when PythonImport is executed
(which is at child initialization time), the config has not yet been
parsed (or rather it has, but the child has no access to it yet).

The bottom line is your mileage may vary with PythonImport.

Grisha

On Thu, 1 Nov 2001, Brian Hawthorne wrote:

> hello,
>
> first i tried the PythonImport directive to preload modules setting up a
> db connection pool.  but the connections were dead when i tried to use
> them.
>
> second, i tried modifying the sitecustomize module which gets imported
> from the site module at interpreter startup (supposedly).  this gave me
> good connections, but it doesn't happen until the first page gets loaded.
>
> i'd like to stuff some pretty time-consuming setup tasks into this phase
> of startup... it should already be done when the first page is requested.
>
> any ideas?
>
> brian hawthorne
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list