Add apache.install_wsgi() convenience function

although you really shouldn't use it
This commit is contained in:
Lance Edgar 2019-09-25 14:17:44 -05:00
parent e81f4afa8f
commit 85baacecc1

View file

@ -38,6 +38,24 @@ def install(c):
apt.install(c, 'apache2')
def install_wsgi(c, python_home=None, python3=True):
"""
Install the mod_wsgi Apache module, with optional ``WSGIPythonHome`` value.
NOTE: you probably should not use this! reverse proxy seems more robust
"""
if python3:
apt.install(c, 'libapache2-mod-wsgi-py3')
else:
apt.install(c, 'libapache2-mod-wsgi')
if python_home:
if get_version(c) == 2.2:
c.sudo("bash -c 'echo WSGIPythonHome {} > /etc/apache2/conf.d/wsgi'".format(python_home))
else: # assuming 2.4
c.sudo("bash -c 'echo WSGIPythonHome {} > /etc/apache2/conf-available/wsgi.conf'".format(python_home))
enable_conf(c, 'wsgi')
def get_version(c):
"""
Fetch the version of Apache running on the target system