Add the possibilty to run ihatemoney via Apache mod_wsgi (#191)

Add the possibilty to run ihatemoney via Apache mod_wsgi

ihatemoney.wsgi is the entry point for mod_wsgi.
A virtualenv can be activated if its path is specified as
an env var in the apache virtual host file
This commit is contained in:
0livd 2017-04-10 17:46:39 +01:00 committed by JocelynDelalande
parent deff0f8bc3
commit cdf903383a
3 changed files with 40 additions and 1 deletions

View file

@ -33,7 +33,21 @@ You can also set the `TESTING` flag to `True` so no mails are sent
Deploy it
=========
To deploy it, I'm using gunicorn and supervisord.
You have multiple options to deploy ihatemoney. Two of them are documented at the moment:
With Apache and mod_wsgi
------------------------
1. Install Apache and mod_wsgi - libapache2-mod-wsgi(-py3) for Debian based and mod_wsgi for RedHat based distributions -
2. Create an Apache virtual host based on the sample configuration file in conf/apache-vhost.conf
3. Adapt it to your paths and specify your virtualenv path if you use one
4. Activate the virtual host if needed and restart Apache
With Nginx, Gunicorn and Supervisord
------------------------------------
1. Add the lines in conf/supervisord.conf to your supervisord.conf file.
**adapt them to your paths!**

16
conf/apache-vhost.conf Normal file
View file

@ -0,0 +1,16 @@
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName ihatemoney.example.com
# Uncomment the python-home option if you use a virtualenv
WSGIDaemonProcess ihatemoney user=www-data group=www-data threads=5 # python-home=/path/to/your/venv
WSGIScriptAlias / /path/to/ihatemoney/ihatemoney.wsgi
ErrorLog /var/log/apache2/ihatemoney.example.com_error.log
CustomLog /var/log/apache2/ihatemoney.example.com_access.log combined
<Directory /path/to/ihatemoney>
WSGIProcessGroup ihatemoney
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
Alias /static/ /path/to/ihatemoney/budget/static/
</VirtualHost>

9
ihatemoney.wsgi Normal file
View file

@ -0,0 +1,9 @@
import sys
import os
__HERE__ = os.path.dirname(os.path.abspath(__file__))
# Add the budget directory to the path so we can then import from run
sys.path.insert(0, os.path.join(__HERE__, 'budget'))
from run import app as application