Syntax:
PythonImport module interpreter_name
Context:
server config
Module:
mod_python.c
Tells the server to import the Python module module at process startup under the specified interpreter name. The import takes place at child process initialization, so the module will actually be imported once for every child process spawned.
The module can be a full module name (package dot notation is
accepted) or an absolute path to a module code file. The module is loaded
using the mod_python module importer as implemented by the
apache.import_module()
function. Reference should be made to
the documentation of that function for further details of how module
importing is managed.
The PythonImport
directive is useful for initialization tasks that
could be time consuming and should not be done at the time of processing a
request, e.g. initializing a database connection. Where such initialization
code could fail and cause the importing of the module to fail, it should be
placed in its own function and the alternate syntax used:
PythonImport module::function interpreter_name
The named function will be called only after the module has been imported successfully. The function will be called with no arguments.
See also Multiple Interpreters.