# HG changeset patch # User Mads Kiilerich # Date 1597326444 -7200 # Node ID 7a1371d659c5d591c5267bd89258b1a0d18ddd59 # Parent 91dcc7be201c81fe53c2a3bc5f7dffb11a6b2115 docs: clarify how to activate virtualenv from mod_wsgi with py3 activate_this.py is not available with the venv module in py3. According to https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html we just need to set python-home - that is the way to do proper virtualenv activation, and there is no need for hacks in the wrapper script. diff -r 91dcc7be201c -r 7a1371d659c5 docs/setup.rst --- a/docs/setup.rst Sat Aug 22 21:07:30 2020 +0200 +++ b/docs/setup.rst Thu Aug 13 15:47:24 2020 +0200 @@ -602,37 +602,19 @@ WSGIRestrictEmbedded On -- Create a WSGI dispatch script, like the one below. Make sure you - check that the paths correctly point to where you installed Kallithea - and its Python Virtual Environment. +- Create a WSGI dispatch script, like the one below. The ``WSGIDaemonProcess`` + ``python-home`` directive will make sure it uses the right Python Virtual + Environment and that paste thus can pick up the right Kallithea + application. .. code-block:: python - import site - site.addsitedir("/srv/kallithea/venv/lib/python3.7/site-packages") - ini = '/srv/kallithea/my.ini' from logging.config import fileConfig fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'}) from paste.deploy import loadapp application = loadapp('config:' + ini) - Or using proper virtualenv activation: - - .. code-block:: python - - activate_this = '/srv/kallithea/venv/bin/activate_this.py' - execfile(activate_this, dict(__file__=activate_this)) - - import os - os.environ['HOME'] = '/srv/kallithea' - - ini = '/srv/kallithea/kallithea.ini' - from logging.config import fileConfig - fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'}) - from paste.deploy import loadapp - application = loadapp('config:' + ini) - - Add the necessary ``WSGI*`` directives to the Apache Virtual Host configuration file, like in the example below. Notice that the WSGI dispatch script created above is referred to with the ``WSGIScriptAlias`` directive. @@ -657,15 +639,6 @@ WSGIScriptAlias / /srv/kallithea/dispatch.wsgi WSGIPassAuthorization On - Or if using a dispatcher WSGI script with proper virtualenv activation: - - .. code-block:: apache - - WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8 - WSGIProcessGroup kallithea - WSGIScriptAlias / /srv/kallithea/dispatch.wsgi - WSGIPassAuthorization On - Other configuration files -------------------------