Skip to content

Latest commit

 

History

History
81 lines (68 loc) · 1.71 KB

README.md

File metadata and controls

81 lines (68 loc) · 1.71 KB

Mappy

Mappy is a Django application to store and show object location on GoogleMaps .

Requirement

  1. Django (tested on version 3.1)
  2. Python (tested on version 3.8)
  3. Google maps API key with Maps JavaScript API enabled get and API key instruction
  4. Generates a random token to protect list of coords which is used for real-time map inside Django

Installation

  1. clone this project
git clone https://github.com/raffaellasuardini/tesi.git
  1. create a virtual env
python -m venv env
source env/bin/activate
  1. install Django Rest Framework
pip install djangorestframework
  1. install Django-Environment
pip install django-environ
  1. create a .env file like this:
DEBUG=ON
SECRET_KEY=your_secret_key
GOOGLE_MAP_KEY=your_api_key
TOKEN=random_token_for_GET

Usage

To activate server

python manage.py runserver

To apply migration

python manage.py migrate

To collect static

python manage.py collectstatic

To create superuser

python manage.py createsuperuser

API Usage

You 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_TOKEN

JSON 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.