Giter Site home page Giter Site logo

geopython17's Introduction

GeoPython 2017

Intro

This repo contains the accompanying code from the Build your own Geospatial Microservice using Python/Flask/PostGIS workshop thinkWhere gave at GeoPython 2017

Dependencies

Following must be available locally:

Optional

The sample app ships with a Dockerfile that allows you to run PostGIS within a Docker container. Alternatively if you have access to an existing PostGIS db you can connect the application to a new database there.

Building the Microservice

  • Create a Python Virtual Environment, using Python 3.6:
    • python -m venv ./venv
  • Activate your virtual environment and install dependencies:
    • Linux/Mac:
      • . ./venv/bin/activate
      • pip install -r requirements.txt
    • Windows (use installer because of precompiled libs):
      • .\venv\scripts\activate
      • pip install -r requirements.txt

Build and run the PostGIS Dockerfile

  • From the root of the project:
    • docker build -t geopython-db ./devops/docker
  • The image should be downloaded and build locally. Once complete you should see it listed, with
    • docker images
  • You can now run the image (this will run PostGIS in a docker container, with port 5432 mapped to localhost):
    • docker run -d -p 5432:5432 geopython-db
  • Confirm the image is running successfully:
    • docker ps

App Config (only required if not using Docker PostGIS)

If you are not using the supplied PostGIS docker container you will need to set the SQLALCHEMY_DATABASE_URI found in ./micro/config.py to point to your database, eg:

SQLALCHEMY_DATABASE_URI=postgresql://user:pass@host/your-new-database

Creating the DB

With everything now setup We use Flask-Migrate to create the database from the migrations directory. Create the database as follows:

python manage.py db upgrade

Running Locally

Finally we can run the application, as follows:

python manage.py runserver -d

Versions

You can see how we got to the version from Flask hello world to v1.0 of our microservice by checking out the tagged releases as follows:

git checkout -b version1 v0.1

It may help to run git clean to tidy up any empty dirs for clarity as you work thru the versions, eg:

git clean -fd

Useful Links

HTTP and Rest

Libraries

Ideas in practice

geopython17's People

Contributors

hunt3ri avatar

Watchers

James Cloos avatar  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.