Giter VIP home page Giter VIP logo

birdseye-server's Introduction

birdseye-server

The Flask-based, PostgreSQL backed REST API to capture observations on the migration patterns of endangered species

Installation

TODO

Development

PostgreSQL database creation & setup

Create the birdseye database, user and set it up with the GIS extension.

sudo apt-get install postgresql-9.6
sudo apt-get install postgresql-9.6-postgis-2.3 postgresql-contrib-9.6 libpq-dev postgis

sudo -i -u postgres

# Create a new user (if a user named 'birdseye' does not exist already)
createuser -P birdseye (password birdseye)

createdb -E UTF8 -O birdseye birdseye
createlang plpgsql birdseye
psql -d birdseye -c "CREATE EXTENSION postgis;"
psql -d birdseye -c "CREATE EXTENSION postgis_topology;"
psql birdseye
grant all on database birdseye to "birdseye";
grant all on spatial_ref_sys to "birdseye";
grant all on geometry_columns to "birdseye";
\q

Python virtualenv setup

Requires python 3.5 (and above) and python-pew to manage the python virtualenv.

pew new birdseye
pip install -r dev-requirements.txt

MacOS X (tested in El Capitan)

Assuming homebrew is used, assuming pip, pew and pythonz are installed.

Install python and friends:

# follow instructions from pythonz to use openssl:
xcode-select --install
brew install openssl
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
pythonz install 3.5.3

Download and install the Postgres app from http://postgresapp.com/ and start a postgres server 9.6.

Setup a database:

brew install postgis
createuser -P birdseye # (password birdseye)
createdb -E UTF8 -O $USER birdseye
createlang plpgsql birdseye
psql -d birdseye << EOT
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
grant all on database birdseye to "birdseye";
grant all on spatial_ref_sys to "birdseye";
grant all on geometry_columns to "birdseye";
EOT

Virtual env setup:

pew new --python=$(pythonz locate 3.5.3) birdseye
pip install -r dev-requirements.txt

Testing

birdseye --help
birdseye reset_tables
birdseye test
birdseye runserver

Note that supporting services also need rq workers launched:

birdseye rq worker  # image labeling
birdseye nginx_upload_chmod_hack  # nginx uploads fiddling with chmod (asks for sudo)

Production

In production gunicorn with gevent is used, will bind to a unix socket created in the same dir from where the server is lauched.

birdseye runproduction

Changelog

  • 0.0.1 - Initial release

birdseye-server's People

Contributors

ioanaverebi avatar mihaibalint avatar petrem avatar

Watchers

 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.