Skip to content

tj-experimental/django_google_app

Repository files navigation

DJANGO app using Google Maps API for synchronizing data to google fusion tables using OAuth2.

Build Status Build status

Source Address Fusion Table

  • Validate access to google fusion table v2 api using OAuth2.
  • Perform updates to google fusion table with locations on the map by clicking or changing the position of the marker on the map.
  • Delete all locations from google fusion by clicking the reset button.
  • Stores previously pinned/clicked locations in the fusion table.
  • Display Fusion tables layer with styles applied (i.e All locations saved in the fusion table have custom style and description Text Content).
  • Personalized Info window for previously searched addresses.

Read the Docs at http://django-google-app.readthedocs.io/en/latest/index.html

Setup requirements

Generate a OAuth client_id.json here.

  • click Create credentials.
  • select OAuth client ID.
  • click on the client ID name to modify the restrictions.
  • add the Authorized JavaScript origins e.g http://localhost:8000
  • add Authorized redirect URIs e.g http://localhost:8000/oauth2callback
  • click download json.

Using the downloaded json file.

  • rename the file to client_id.json.
  • replace client_id.json in project root.

OR

Using the json file copy and set env variables

  • CLIENT_ID , PROJECT_ID, CLIENT_SECRET.

Manage API Keys from the Console

Generate an API key here for Google Maps API, and Google Fusion Table REST API to keep track of usage information.

Create google_api_keys.json to store the api keys.
{
  "maps-api-key": "[[insert google map api key]]",
  "fusion-table-api-key": "[[insert google fusion table api key]]"
}
OR Optionally set ENV vars
EASY_MAPS_GOOGLE_MAPS_API_KEY=

GOOGLE_FUSION_TABLE_API_KEY=

Create a virtual environment using virtualenvwrapper

  • Run
pip install virtualenvwrapper
mkvirtualenv localve

Setup with virtualenv

pip install virtualenv
virtualenv localve

On Windows activate the virtaulenv.

localve\Scripts\activate

On Posix system activate the virtualenv

source localve/bin/activate

Install the project requirements

pip3 install -r requirements.txt
npm install

Run migrations

python3 manage.py migrate

Start web server

python3 manage.py runserver

OR

make run

Local Development

git clone https://github.com/jackton1/django_google_app.git
cd django_google_app
pip install -e . -r requirements.txt
npm install 
python3 manage.py migrate 

Generate Documentation

cd docs
make html
OR Run in project root make docs

View Documentation

cd docs
sphinx-serve -b build
Visit

http://localhost:8081

OR run make view_docs

This opens up a browser window with the documentation url http://localhost:8081.

Run Test

pip install -e .[test]
make test
tox