5.2.3 PythonImport

Syntax: PythonImport module ...
Context: directory
Module: mod_python.c

Tells the server to import the Python module module at process startup. This is useful for initialization tasks that could be time consuming and should not be done at the request processing time, e.g. initializing a database connection.

The import takes place at child process initialization, so the module will actually be imported once for every child process spawned.

Note that at the time when the import takes place, the configuration is not completely read yet, so all other directives, including PythonInterpreter have no effect on the behavior of modules imported by this directive. Because of this limitation, the use of this directive should be limited to situations where it is absolutely necessary, and the recommended approach to one-time initializations should be to use the Python import mechanism.

The module will be imported within the subinterpreter according with the directory name specified by the <Directory> directive. For all other subinterpreters, the module will not appear imported.

See also Multiple Interpreters.

What is this????