GeoKey is a platform for participatory mapping, that is developed by Extreme Citizen Science research group at University College London.
Download and install Docker CE for your platform. This will include the docker-compose command used below.
- Pull and extract relevant images, build the GeoKey application container:
docker-compose up --build
- In another terminal window migrate the database:
docker-compose exec geokey python manage.py migrate
- Run the collectstatic management command:
docker-compose exec geokey python manage.py collectstatic --noinput
- Fin ally run the server:
docker-compose exec geokey python manage.py runserver 0.0.0.0:8000
If everything went well, there should be a GeoKey instance available on your system at http://localhost:9000.
For development purposes, the source code is also mounted as a volume in the geokey container, which means that changes made to the source code on the host machine are reflected in the container.
GeoKey can be run on Python 2.7 only.
- Update your system:
sudo apt-get update && sudo apt-get upgrade
- Install PostgreSQL and PostGIS (we follow the official guides):
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt wheezy-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.4-postgis-2.1 postgresql-contrib postgresql-server-dev-9.4
- Setup all other dependencies:
sudo apt-get install python-pip python-virtualenv python-dev libjpeg-dev binutils libproj-dev libav-tools gdal-bin python-gdal
For Ubuntu you might also need to install libavcodec-extra-52 or libavcodec-extra-53.
- For simplicity, switch to user postgres:
sudo su - postgres
- Install PostGIS in template1 (required for running tests):
psql -d template1 -c 'create extension hstore;'
- Log in to the database:
psql
- Create the user (replace django with your user):
postgres=# CREATE USER django WITH PASSWORD 'django123';
- Make created user a superuser on your database (this is required for tests only and shouldn't be done in production):
postgres=# ALTER ROLE django WITH superuser;
- Create the database (replace django with your user and geokey with a desired name for the database):
postgres=# CREATE DATABASE geokey OWNER django;
- Log out and connect to the database:
postgres=# \q
psql -d geokey
- Install the required extensions:
geokey=# CREATE EXTENSION postgis;
geokey=# CREATE EXTENSION hstore;
- Log out of the database and a user:
geokey=# \q
logout
- Clone the repository:
git clone https://github.com/ExCiteS/geokey.git
- Install the package and development requirements:
cd geokey
pip install -e .
pip install -r requirements.txt
pip install -r requirements-dev.txt
You may need to add sudo before the pip commands, unless you are logged in as root or working within a virtual environment.
- Copy the directory local_settings.example to local_settings
cp -r local_settings.example local_settings
- Inside the local_settings open settings.py in a text editor and...
Add your database settings:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geokey',
'USER': 'django',
'PASSWORD': 'xxxxxxxxx',
'HOST': 'host', # usually 'localhost'
'PORT': ''
}
}
Set the secret key:
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
Set the STATIC_ROOT directory:
STATIC_ROOT = '/some/path/'
- Migrate the database:
python manage.py migrate
- Add yourself as a superuser (you can use the same email and password to log into the system later):
python manage.py createsuperuser
- Run the collectstatic management command:
python manage.py collectstatic
python manage.py runserver 0.0.0.0:8000
python manage.py test
Running tests will remove all uploaded images of contributions from the assets directory. If you require to keep them, please use custom test settings with a --settings flag.
GeoKey was built using some amazing open-source technology. We would like to thank all contributors to these projects:
- Django
- django-rest-framework
- django-rest-framework-gis
- django-hstore
- django-braces
- django-pgjson
- django-allauth
- django-oauth-toolkit
- django-model-utils
- django-simple-history
- django-aggregate-if
- django-youtube
- psycopg2
- iso8601
- pillow
- django_nose
- pytz
- gdata
- easy-thumbnails
- moment
- requests
- factory-boy
- Handlebars
- Modernizr
- Leaflet
- Leaflet.Draw
- jQuery
- Bootstrap
- bootstrap-colorpicker
- bootstrap-datetimepicker
- bootstrap-fileinput