4.38. Apache integration via mod_python

In a production environment, it is highly recommended to use the PyDADL server within the apache HTTP server via mod_python. The installation procedure of those components is beyond the scope of this document, please refer to your distribution documentation or websites of those components to know how you can install them.

You need to setup an apache configuration file. Here is a minimal configuration :

Listen 12345
User nobody
PidFile /path/to/project/tmp/httpd.pid

LoadModule ssl_module modules/mod_ssl.so
LoadModule python_module modules/mod_python.so

SetHandler mod_python
PythonAutoReload On
PythonDebug On
PythonInterpreter main_interpreter
PythonImport PyDADL.server.apache main_interpreter
PythonHandlerModule PyDADL.server.apache
PythonOption ConfigFile /path/to/project/etc/server.conf

<IfModule ssl_module>
    SSLEngine on
    SSLCertificateFile /path/to/project/etc/cert.pem
    SSLCertificateKeyFile /path/to/project/etc/pkey.pem

LogLevel notice
<IfModule log_config_module>
    CustomLog /path/to/project/log/httpd_access.log common
    ErrorLog /path/to/project/log/httpd_error.log

Replace /path/to/project with you project's directory.

PythonAutoReload and PythonDebug can be set to Off in a production environment.

To start the apache http server :

export PYTHON_EGG_CACHE=/path/to/project/tmp
export PYTHONHOME=/path/to/python_dir
httpd -f /path/to/project/etc/httpd.conf -k start

Please adapt the paths to your installation layout.

The apache's configuration file and apache start script are generated with the pydadl_new_project script.