Mercurial > kallithea
comparison docs/setup.rst @ 8610:7a1371d659c5
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 13 Aug 2020 15:47:24 +0200 |
parents | 291f04a72288 |
children | 4d742b172010 |
comparison
equal
deleted
inserted
replaced
8609:91dcc7be201c | 8610:7a1371d659c5 |
---|---|
600 used in the WSGI processes and shouldn't be initialized in the Apache | 600 used in the WSGI processes and shouldn't be initialized in the Apache |
601 processes:: | 601 processes:: |
602 | 602 |
603 WSGIRestrictEmbedded On | 603 WSGIRestrictEmbedded On |
604 | 604 |
605 - Create a WSGI dispatch script, like the one below. Make sure you | 605 - Create a WSGI dispatch script, like the one below. The ``WSGIDaemonProcess`` |
606 check that the paths correctly point to where you installed Kallithea | 606 ``python-home`` directive will make sure it uses the right Python Virtual |
607 and its Python Virtual Environment. | 607 Environment and that paste thus can pick up the right Kallithea |
608 application. | |
608 | 609 |
609 .. code-block:: python | 610 .. code-block:: python |
610 | 611 |
611 import site | |
612 site.addsitedir("/srv/kallithea/venv/lib/python3.7/site-packages") | |
613 | |
614 ini = '/srv/kallithea/my.ini' | 612 ini = '/srv/kallithea/my.ini' |
615 from logging.config import fileConfig | |
616 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'}) | |
617 from paste.deploy import loadapp | |
618 application = loadapp('config:' + ini) | |
619 | |
620 Or using proper virtualenv activation: | |
621 | |
622 .. code-block:: python | |
623 | |
624 activate_this = '/srv/kallithea/venv/bin/activate_this.py' | |
625 execfile(activate_this, dict(__file__=activate_this)) | |
626 | |
627 import os | |
628 os.environ['HOME'] = '/srv/kallithea' | |
629 | |
630 ini = '/srv/kallithea/kallithea.ini' | |
631 from logging.config import fileConfig | 613 from logging.config import fileConfig |
632 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'}) | 614 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'}) |
633 from paste.deploy import loadapp | 615 from paste.deploy import loadapp |
634 application = loadapp('config:' + ini) | 616 application = loadapp('config:' + ini) |
635 | 617 |
651 | 633 |
652 .. code-block:: apache | 634 .. code-block:: apache |
653 | 635 |
654 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \ | 636 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \ |
655 python-home=/srv/kallithea/venv lang=C.UTF-8 | 637 python-home=/srv/kallithea/venv lang=C.UTF-8 |
656 WSGIProcessGroup kallithea | |
657 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi | |
658 WSGIPassAuthorization On | |
659 | |
660 Or if using a dispatcher WSGI script with proper virtualenv activation: | |
661 | |
662 .. code-block:: apache | |
663 | |
664 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8 | |
665 WSGIProcessGroup kallithea | 638 WSGIProcessGroup kallithea |
666 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi | 639 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi |
667 WSGIPassAuthorization On | 640 WSGIPassAuthorization On |
668 | 641 |
669 | 642 |