Quick development setup
- Install Python
sudo apt install python3
sudo apt install python3-pip
- Install the required dynamic libraries
sudo apt install libgdal-dev
- Install the required Python libraries for the server
pip3 install -r requirements.txt
- Setup PostgreSQL
sudo apt install postgresql
sudo apt install postgis
sudo -u postgres -i psql
create user USERNAME with password ‘PASSWORD’;
create database retour;
\c retour
create extension postgis;
\q
- Configure the server
- Copy
landscapelab/settings/local_settings.py-dist
tolandscapelab/settings/local_settings.py
and edit the database information according to what was entered in the previous step - Copy
logging.conf-dist
tologging.conf
and configure as desired
- Copy
- Fill the database
python3 manage.py migrate
python3 manage.py loaddata defaults.json
(TODO: This doesn't load all required data yet)
- Insert geodata from an external folder with a symlink
ln -s /external/path/to/resources landscapelab/resources
- Run the server
python3 manage.py runserver
Optional: Test the setup with a request such as http://127.0.0.1:8000/raster/1768618.0/6008552.0/12.json
(should return valid images) or http://127.0.0.1:8000/assetpos/get_all_editable_assettypes.json
(should return a list of asset types).
For a more flexible setup, Anaconda and PyCharm are recommended.
Setting up the production environment using bitnami
- install the unofficial wheel builds for GDAL, Fiona and rasterio
- copy the gdal20X.dll and geos_c.dll from the site-packages/osgeo directory in python to the apache2 root directory of bitnami
- add GDAL_LIBRARY_PATH and GEOS_LIBRARY_PATH to local_settings.py and point them to gdal20X.dll and geos_c.dll
- add the environment paths for GDAL_DATA and PROJ_LIB
- add all local ip-adresses into ALLOWED_HOSTS in local_settings.py
Run the server
- development:
python manage.py runserver
- production: use a wsgi compatible server and deploy the app