This guide walks you through the setup for running GeoKey in Apache using
mod_wsgi. We assume that you have already installed GeoKey.
sudo apt-get install apache2 libapache2-mod-wsgi
Head to Apache www directory
Create a directory for GeoKey specific files
sudo mkdir geokey
Create directories for static files and assets uploaded by users
sudo mkdir geokey/static
sudo mkdir geokey/media
sudo vim /home/django/runner/local_settings.py
Add or change settings for
STATIC_ROOT = '/var/www/geokey/static/'
STATIC_URL = '/static/'
MEDIA_ROOT = '/var/www/geokey/media/'
MEDIA_URL = '/media/'
Collect static files from the Python packages (they will be automatically stored under
python manage.py collectstatic
Depending on your user role, you might need to add temporarily writing permission to
Finally, allow Apache to write to you media directory
chgrp -R www-data /var/www/geokey/media/
chmod -R 775 /var/www/geokey/media/
We are going to use the default virtual host provided by the Apache installation. The same configuration can be applied to other virtual hosts on your system.
Open the Apache configuration file in your text editor (we use vim, because it’s awesome):
Add the following lines just below
WSGIDaemonProcess geokey python-path=/home/django:/home/django/env/lib/python2.7/site-packages
WSGIScriptAlias / /home/django/wsgi.py
This first line creates a new WSGI daemon that runs GeoKey in Apache. Its name (in our case
geokey) can be anything, but you should use a descriptive name. The
python-path directive contains both the path of your Django project and the path to the Python packages inside your virtual environment.
The third line tells the virtual host to use the WSGI daemon we just created.
The fourth line tells Apache and mod_wsgi where to find the WSGI configuration.
The last line enables WSGI to pass authorisation credentials to the Django application. This is necessary, because Django would not be able to authenticate users otherwise.
We then have to tell Apache where to find static and media files from your Django project (temember, we previously created these directories and copied the static files)
Alias /static/ /var/www/geokey/static/
Alias /media/ /var/www/geokey/media/
To tell WSGI where to find configuration files for our Django project, open the WSGI configuration in your text editor
sudo vim /home/django/runner/wsgi.py
Add following line just below
from django.core.wsgi import get_wsgi_application
Now restart the Apache
sudo service apache2 restart
Point your browser to your domain. You should see the admin landing page now.
Videos are – by default – uploaded to your YouTube account.
You will need to obtain YouTube API keys following this guide.
ENABLE_VIDEO flag in
ENABLE_VIDEO = True
The add the credentials to
YOUTUBE_AUTH_EMAIL = 'firstname.lastname@example.org'
YOUTUBE_AUTH_PASSWORD = 'password'
YOUTUBE_DEVELOPER_KEY = 'xxxxxxxxxxx'
YOUTUBE_CLIENT_ID = 'xxxxxxxxxxx.apps.googleusercontent.com'
GeoKey uses email in various cases; for instance, when users want to reset their password. We therefore need to setup Postfix to send email from your server.
First install Postfix
apt-get update && apt-get install postfix
Add a default email address that is used as sender for e-ails send by Django in
DEFAULT_FROM_EMAIL = 'email@example.com'