Skip to content

Latest commit

 

History

History
56 lines (33 loc) · 1.65 KB

README.md

File metadata and controls

56 lines (33 loc) · 1.65 KB

3DmapsDjango

Adding maps to your Django apps. The following steps will guide you through on how to add maps to your django projects. Along with, displaying 3D buildings. I have used Mapbox api for this project.

Sign-up for Mapbox

Head to the Mapbox. Click on "Get started". Sign up for a free account. Once you have signed in, Click the "JS Web" option. Then, choose "Use the Mapbox CDN" to install Mapbox GL JS. Once you have done that you will be provided with a access token, like this one "pk.eyJ1IjoIcGVuh29veCIsImEiOiJjampHNshreDkwbGZ5M3BxbXZkdDQ0dGdpIn1.-36WPGfz6NY90m3trPkNyw".

2018-07-08 1

Getting started

  • Clone the repository.
  • Create a virtual environment.

python -m venv djangomaps

  • Activate the virtualenv

.\Scripts\activate (Windows users)

or

source djangomaps/bin/activate (mac users)

  • This will install all the neccessary packages.

pip install -r requirements.txt

  • After its done, cd into src/maps, open views.py and put the access token within the quotes. Go ahead and run the application.
python manage.py runserver
  • Go to localhost

local

Detailed instructions

Usage

views.py

def default_maps(request):
	# TODO: move Token to settings.py file
	mapbox_access_token = 'PUT TOKEN HERE.'
	
	return render(request, 'details.html', {'mapbox_access_token':mapbox_access_token})