Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

alphagov/land-availability-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

land-avilability-api

API backend for Land Availability tool

Continuous integration status

Travis-CI Status Coverage Status

PostgreSQL Setup

Make sure you have PostgreSQL (tested with 9.6) installed along with PostGIS extension. You can find more information for the different operating systems here: https://docs.djangoproject.com/en/1.10/ref/contrib/gis/install/postgis/

It's strongly suggested to use Postgres.app on OSX and to install all the other tools and dependencies using brew.

Create DB

createdb landavailability
psql landavailability
> CREATE EXTENSION postgis;

Project Configuration

Make sure you have this environment variable set:

SECRET_KEY=<random string>
DATABASE_URL=postgres://USERNAME:PASSWORD@HOST:PORT/DBNAME

example:

SECRET_KEY=abc1234
DATABASE_URL=postgres://andreagrandi@localhost:5432/landavailability

If you are using a Python virtual environment, you can save these values in $venv_folder/bin/postactivate script:

export SECRET_KEY=abc1234
export DATABASE_URL=postgres://andreagrandi@localhost:5432/landavailability

Access

Create user and key

The Land Availability UI needs a user and token. To create these, inside a ./manage.py shell run:

from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
user = User.objects.create_user('ui')
user.save()
token = Token.objects.create(user=user)
print(token.key)

Tests

Run the tests with:

pytest

About

API backend for Land Availability tool

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages