Giter Site home page Giter Site logo

leroyg / django-google-maps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jessamynsmith/django-google-maps

0.0 1.0 0.0 33 KB

Example using postgis and google maps with Django on heroku

Home Page: https://django-google-maps.herokuapp.com/

Python 65.10% CSS 3.85% HTML 13.89% JavaScript 17.16%

django-google-maps's Introduction

django-google-maps

This is an example of a heroku-deployable app using postgis and google maps. https://django-google-maps.herokuapp.com/

Like my work? Tip me! https://www.paypal.me/jessamynsmith

Development

Fork the project on github and git clone your fork, e.g.:

git clone https://github.com/<username>/django-google-maps.git

Create a virtualenv using Python 3 and install dependencies. I recommend getting python3 using a package manager (homebrew on OSX), then installing virtualenv and virtualenvwrapper to that python. NOTE! You must change 'path/to/python3' to be the actual path to python3 on your system.

mkvirtualenv django-google-maps --python=/path/to/python3
pip install -r requirements/development.txt

Sign up for the Yelp Fusion API and create an app as directed: https://www.yelp.com/developers/documentation/v3/authentication Set environment variables for your Yelp app:

export YELP_API_KEY=<VALUE_FROM_YELP>

Sign up for a Google maps and get an API key: https://developers.google.com/maps/documentation/javascript/get-api-key Set environment variable for Google maps:

export GOOGLE_MAPS_API_KEY=<VALUE_FROM_GOOGLE>

Set environment variables as desired. Recommended dev settings:

export DJANGO_DEBUG=1
export DJANGO_ENABLE_SSL=0

Optional environment variables, generally only required in production:

DJANGO_SECRET_KEY

You can add the exporting of environment variables to the virtualenv activate script so they are always available.

Database

This app requires PostgreSQL. I recommend installing using a package manager (homebrew on OSX).

Create a database:

createdb django-google-maps

Enable the postgis extension:

psql django-google-maps
create extension postgis;

Set up db:

python manage.py migrate
Testing

Run tests:

python manage.py test

Check code style:

flake8

Run server:

python manage.py runserver

Or run using gunicorn:

gunicorn django-google-maps.wsgi

Lint JavaScript:

./node_modules/jshint/bin/jshint */static/*/js

Continuous Integration and Deployment

This project is already set up for deployment to Heroku.

Create application (note the geo buildpack will only work on cedar-14):

heroku create --stack heroku-18 <app_name>

Be sure to add your heroku app to ALLOWED_HOSTS in settings.py

Add postgresql addon:

heroku addons:add heroku-postgresql

Enable extension in database:

heroku pg:psql
create extension postgis;

Set environment variables:

heroku config:set BUILD_WITH_GEO_LIBRARIES=1 # Required to enable GDAL in python buildpack
heroku config:set YELP_API_KEY=<VALUE_FROM_YELP>
heroku config:set GOOGLE_MAPS_API_KEY=<VALUE_FROM_GOOGLE>

You can deploy manually using:

git push heroku master

Or configure Heroku for automatic deployment from GitHub.

django-google-maps's People

Contributors

dependabot[bot] avatar jessamynsmith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.