Giter VIP home page Giter VIP logo

ban's Introduction

Build Status Coverage Status Requirements Status # BAN

This is a POC of API for managing the future "Base adresses nationale".

Install

OSX

Install system dependencies with homebrew (or by hand)

brew install postgres postgis

Linux

Install system dependencies

sudo apt-get build-dep python-psycopg2
sudo apt-get install python3.4 python3.4-dev python-virtualenv postgresql-9.4 postgis build-essential libffi-dev

Create a virtualenv (but you'd better use virtualenvwrapper or pew):

virtualenv banenv --python=`which python3.4`
source banenv/bin/activate

Install developpement tools

pip install ipython ipdb

Create a psql database

sudo -u postgres createdb ban -O youruser

Add postgis and hstore extensions

psql ban
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;

Windows

Install system dependencies

-Configure your environment variables: setx path "%PATH%;C:\New Folder" (user variable) or set path "%PATH%;C:\New Folder" (system variable)

Create a virtualenv

pip install virtualenv
virtualenv banenv
banenv/Scripts/activate.bat

Install developpement tools

pip install ipython pyreadline ipdb

Create a psql database

createdb -U youruser ban

Add postgis and hstore extensions

psql ban youruser
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;

Project configuration

Clone repository

git clone https://github.com/BaseAdresseNationale/ban
cd ban/

Install python dependencies

pip install -r requirements.txt

Install ban locally

python setup.py develop

Data setup

Create tables

ban db:create

Create at least use staff user

ban auth:createuser --is-staff

Import municipalities (get the file from http://www.collectivites-locales.gouv.fr/files/files/epcicom2015.csv)

ban import:municipalities epcicom2015.csv --departement 33

Import some adresses (get data from http://bano.openstreetmap.fr/BAN_odbl/)

ban import:oldban BAN_odbl_33-json

Run the server

Create a dummy token for development:

ban auth:dummytoken blablablabla

You will need to use it for any request to the API, passing the header Authorization: Bearer blablablabla. Replace blablablabla both on the command line and header value by any other value you can remember easily.

http 'http://localhost:5959/' Authorization:'Bearer blablablabla'

This is just for development, never user this command in production servers.

For development:

ban server:run

For production, you need to use either gunicorn or uwsgi.

Load the API root to get the available endpoints:

http http://localhost:5959/

ban's People

Contributors

yohanboniface avatar apside-bdx-bbo avatar flyusfly avatar cquest avatar davidbgk avatar vinyll avatar christopheprudent avatar

Watchers

FranckBernard 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.