Represent Boundaries is a Django app, which you can deploy on its own or integrate into an existing Django project. Its source code is available on GitHub.
Install dependencies
Represent Boundaries requires Python 2.6, 2.7, 3.3 or 3.4 and PostGIS. Follow GeoDjango’s instructions, or use the quick-start guide for OS X users below.
If you have issues installing dependencies, check GeoDjango’s help section.
Mac OS X
This guide assumes you are using Homebrew as your package manager. If you use MacPorts or Fink, the steps are similar.
- Install Xcode
- Install Homebrew
-
Ensure Homebrew is up-to-date:
brew update
-
Ensure Homebrew is ready to go. Most warnings can be safely ignored:
brew doctor
-
Install Python 2.7, which will install pip and setuptools:
brew install python
-
Install GDAL and PostGIS:
brew install gdal postgis
-
Follow the instructions to start a PostgreSQL server:
brew info postgresql
Install Represent Boundaries
-
Create a PostGIS database:
createdb my_database psql my_database -c "CREATE EXTENSION postgis;"
-
Install Django, psycopg2 and Represent Boundaries:
pip install Django psycopg2 represent-boundaries
-
Start a new Django project. Skip this step if you are integrating Represent Boundaries into an existing Django project.
django-admin.py startproject my_project cd my_project
-
In
my_project/settings.py
, configure the default database to connect to the PostGIS database you created above. -
In
my_project/settings.py
, add these lines to the end of theINSTALLED_APPS
list:'django.contrib.gis', 'boundaries',
-
In
my_project/urls.py
, add this line to the end of theurlpatterns
list:url('', include('boundaries.urls')),
-
From your project’s directory, run:
python manage.py migrate
You can now run python manage.py runserver
and navigate to http://127.0.0.1:8000/boundary-sets/ to see your empty API. Let’s add some data!