summaryrefslogtreecommitdiff
path: root/docs/config-directives/WSGIImportScript.rst
blob: 7705b792264b4d5482cee8f21e2d0368ad17fb53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
================
WSGIImportScript
================

:Description: Specify a script file to be loaded on process start.
:Syntax: ``WSGIImportScript`` *path* ``[`` *options* ``]``
:Context: server config

The WSGIImportScript directive can be used to specify a script file to be
loaded when a process starts. Options must be provided to indicate the name
of the process group and the application group into which the script will
be loaded.

The options which must supplied to the WSGIImportScript directive are:

**process-group=name**
    Specifies the name of the process group for which the script file will
    be loaded.
    
    The name of the process group can be set to the special value
    '%{GLOBAL}' which denotes that the script file be loaded for the Apache
    child processes. Any other value indicates appropriate process group
    for mod_wsgi daemon mode.

**application-group=name**
    Specifies the name of the application group within the specified
    process for which the script file will be loaded.

    The name of the application group can be set to the special value
    '%{GLOBAL}' which denotes that the script file be loaded within the
    context of the first interpreter created by Python when it is
    initialised. Otherwise, will be loaded into the interpreter for the
    specified application group.

Because the script files are loaded prior to beginning to accept any
requests, any delay in loading the script will not cause actual requests to
be blocked. As such, the WSGIImportScript can be used to preload a WSGI
application script file on process start so that it is ready when actual
user requests arrive. For where there are multiple processes handling
requests, this can reduce or eliminate the apparent stalling of an
application when performing a restart of Apache or a daemon mode process
group.