This repository is outdated. The new versions are deployed on this repository.
TooPath v3 is an API that let you manage tracks and locations related to a device. This API is protected with JWT authentication and follows the GeoJSON RFC 7946.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Install python 3.6.1.
- Install OSGeo4W following the steps in GeoDjango Tutorial (make sure to install the same bit version of python and OSGeo4W.
- Install PyCharm (optional, recommended for windows users).
- Install virtualenvwrapper-win via
easy_install virtualenvwrapper-win
- Install VirtualBox 5.1.
- Install Vagrant 2.0.1.
- Install virtualenvwrapper via
pip install virtualenvwrapper
. - Install PostgreSQL 9.6.
- Install PostGIS 2.3.
This environment setup can be done via console and also, via PyCharm console (if you have installed this IDE). First of all, create a virtual environment:
mkvirtualenv [virtual_environment_name]
If the virtual environment is not automatically activated, then use:
workon [virtual_environment_name]
Install all the python requirements:
pip install -r requirements.txt
As it is recommended on this settings tutorial, this project has production and local separate settings. To use the local settings setup your DJANGO_SETTINGS_MODULE environment variable to TooPath3.settings.local
.
For windows users, follow this Getting started of Vagrant to create a virtual machine with PostgreSQL and PostGIS (use the versions on Linux section).
For linux users, you can create the database with the PostgreSQL and PostGIS previously installed.
Apply all the migrations with:
python manage.py migrate
- Go to File>Settings>Project:"name">Project interpreter>Add local
- Select python.exe from [virtual_environment_name] folder
- Mark Associate this virtual environment with current project
- Configure the settings INSTALLED_APPS and DATABASES following the steps in Configure settings.py
Use python manage.py runserver x.x.x.x:aaaa
where x.x.x.x is the address and aaaa is the port. For local example:
python manage.py runserver 127.0.0.1:8080
Once you’ve written tests, run them using the test command of your project’s manage.py utility:
python manage.py test
If you wanna run a concrete test you can do it specifying the package. For example, to run the devices test:
python manage.py test TooPath3.devices.tests
To apply the migrations on the production environment use:
python manage.py migrate --settings=TooPath3.settings.production
To start the API on the production enviroment use:
python manage.py runserver x.x.x.x:aaaa --settings=TooPath3.settings.production
Youn can also setup the DJANGO_SETTINGS_MODULE environment variable to TooPath3.settings.production
.
- Django REST - framework used.
- Django REST-gis - Geographic add-ons for Django REST.
- Jenkins - Integration tool
- Albert Díaz Benitez - First stable version - AlbertWayne
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details.