-
Notifications
You must be signed in to change notification settings - Fork 66
Janeway, Apache and WSGI
This guide is a brief look at setting up Janeway with Apache and mod_wsgi in the live environment:
Note: you should not run this installer as root and will have to give the apache www-data user access to your folders inc .virtualenvs
Note: janeway must be at the root of your domain in apache if using path based domains, not at a pathway itself ie:
janeway.example.com or example.com or testing.test.com
not
example.com/janeway/
sudo chown -R youruser:www-data /path/to/janeway/
&&
sudo adduser www-data youruser
Install apache and mod_wsgi:
sudo apt-get install apache2 libapache2-mod-wsgi-py3
Go the to sites-avaialble directory:
cd /etc/apache2/sites-available/
Add a new config file, you can call it whatever you want:
nano 000-janeway.conf
add the following:
<VirtualHost *:80>
RewriteEngine on
RewriteOptions Inherit
Alias /media/ /path/to/janeway/src/media/
<Directory /path/to/janeway/src/media>
Require all granted
</Directory>
Alias /static/ /path/to/janeway/src/collected-static/
<Directory /path/to/janeway/src/collected-static>
Require all granted
</Directory>
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /path/to/janeway/src/core/wsgi.py
WSGIDaemonProcess janeway python-home=/path/to/virtualenvironment python-path=/path/to/janeway/src
WSGIProcessGroup janeway
<Directory /path/to/janeway/src/core/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# http://wiki.apache.org/httpd/InternalDummyConnection
# disable logging of the "(internal dummy connection)" requests.
# may be skewing traffic reported by logwatch.
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
ErrorLog ${APACHE_LOG_DIR}/janeway_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/janeway.log vhost_combined env=!loopback
</VirtualHost>
**NOTES:
- If you are using a different version of Debian/Ubuntu/etc the default Python version may not be 3.5 so ensure you check this.**
-
/path/to/janeway
refers to the path were the janeway source has been cloned. e.g.:/home/$USER/git/janeway
-
/path/to/virtualenvironment
refers to the virtualenvironment in which the janeway requirements have been installed. e.g.:/home/$USER/.viertualenvs/janeway
You may have to disable 000-default.conf as we want janeway.conf to be the default and pick up domains.
a2dissite 000-default && a2ensite 000-janeway.conf
Then we need to edit the wsgi.py:
__copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
"""
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/path/to/janeway/src')
sys.path.append('/path/to/.virtualenvs/janeway/lib/python3.5/site-packages')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
application = get_wsgi_application()
Restart apache with:
service apache2 restart
Wiki has moved to read the docs.