-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
Alexia is written in Python 2.7 and uses the Django framework.
Alexia also requires a database engine. Several databases engines are supported by Django.
This installation guide assumes a UNIX-like operating system.
You can download Python 2.7 from http://www.python.org/download/ or use the package manager of your operating system.
You can download the source code of Alexia by cloning the git repository on your system, for example in the /data/applications/alexia
folder:
cd /data/applications
git clone https://github.com/Inter-Actief/alexia.git
Alexia uses several Python libraries. We recommend creating a virtual environment to install the libraries so the libraries for Alexia will not conflict with other Python projects.
See https://virtualenv.pypa.io/ for installation instructions of the virtualenv tool.
You can create a virtual environment for Alexia, for example in the /data/environments/alexia
directory with the following commands:
cd /data/environments
virtualenv alexia
To activate your virtual environment in your current shell, use:
. /data/environments/alexia/bin/activate
To deactivate the virtual environment, you can type:
deactivate
All further commands assume an activated virtual environment and should be executed form the /data/appliations/alexia
directory, so execute:
cd /data/applications/alexia
. /data/environments/alexia/bin/activate
To install the required packages, use the following commands. Make sure the virtual environment is activated.
pip install -r config/requirements.txt
This will download and install all required Python packages as listed in the file conf/requirements.txt.
Copy the file local_settings.py.default
to local_settings.py
. In local_settings.py
you can add and alter the settings for your Alexia installation. The file settings.py
contains the initial settings for Alexia. Please do not edit this file but override the settings using local_settings.py
.
You need to configure at least the DATABASES
and SECRET_KEY
settings. When you make your Alexia installation available to everyone you want also the configure the other settings and set DEBUG
to False
.
You can check if the installation and configuration of Alexia went correctly using the following command:
python manage.py validate
To create the database tables used for Alexia run the following command:
python manage.py migrate
To create a super user, a user that has all rights in your Alexia installation and can access the admin interface, use the following command. This will prompt for a username, email address and password.
python manage.py createsuperuser
See the page Global settings for all settings. Especially don't forget to configure RADIUS authentication.
The static
and media
directories should be writeable by the UNIX user running the webserver, see the STATIC_ROOT
and MEDIA_ROOT
settings. All other Alexia files should be readable by the webserver.
You can start Alexia using a temporary webserver with the following command:
python manage.py runserver 0:8000
This will make Alexia available on port 8000 on your server. You can visit Alexia on http://yourserver:8000/
.
This temporary server is only meant for testing and development purposes and should not be used in production environments.
For production environments Alexia can be deployed using WSGI. Django provides a “How-to” guide: How to deploy with WSGI. The Alexia repository provides a preconfigured wsgi.py
file.
The media
folder should not be accessible using the webserver, because it is used to upload private data (IVA certificates) and access is granted through Alexia.
Make sure the static
folder is accessible, see also the STATIC_ROOT
and STATIC_URL
.
You should run the python manage.py collectstatic
command to populate the static
directory. You should run this command after installation and after every upgrade.
Deploying Alexia with Apache and mod_wsgi is a tried and tested way to get Alexia into production.
See also the Django guide How to use Django with Apache and mod_wsgi.
Example configuration:
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName alex.ia.utwente.nl
ErrorLog /var/log/apache2/httpd-alexia-error.log
CustomLog /var/log/apache2/httpd-alexia-access.log combined
# Include your SSL configuration here
Include ssl.conf
# Django WSGI config
# Based on https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/
WSGIDaemonProcess alexia user=www-data group=www-data display-name='%{GROUP}' \
python-path=/data/applications/alexia:/data/environment/alexia/lib/python2.7/site-packages
WSGIProcessGroup alexia
Alias /static/ /data/applications/alexia/static/
<Directory /data/applications/alexia/static>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /data/applications/alexia/wsgi.py
<Directory /data/applications/alexia>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
To the extent possible under law, I.C.T.S.V. Inter-Actief and individual contributors
has waived all copyright and related or neighboring rights to the
Alexia Wiki.