Mappy is a Django application to store and show object location on GoogleMaps .
- Django (tested on version 3.1)
- Python (tested on version 3.8)
- Google maps API key with Maps JavaScript API enabled get and API key instruction
- Generates a random token to protect list of coords which is used for real-time map inside Django
- clone this project
git clone https://github.com/raffaellasuardini/tesi.git- create a virtual env
python -m venv env
source env/bin/activate- install Django Rest Framework
pip install djangorestframework- install Django-Environment
pip install django-environ- create a .env file like this:
DEBUG=ON
SECRET_KEY=your_secret_key
GOOGLE_MAP_KEY=your_api_key
TOKEN=random_token_for_GETTo activate server
python manage.py runserverTo apply migration
python manage.py migrateTo collect static
python manage.py collectstaticTo create superuser
python manage.py createsuperuserYou can only use POST to insert new coords with a request to the endpoint:
http://YOUR_DOMAIN/api/coord/If you need a list of coords with GET method use this endpoint with your token:
http://YOUR_DOMAIN/api/coord/list/?token=YOUR_TOKENJSON Request format:
{
object_label: 'label for the point',
lat: 'latitude',
lng: 'longitude'
}If object_label exist API updates coords, else a new one is created.