Skip to content

Instantly share code, notes, and snippets.

@mrcnc
Last active April 19, 2019 02:16
Show Gist options
  • Select an option

  • Save mrcnc/e252ea829ed80316f2001de4c6eabfb6 to your computer and use it in GitHub Desktop.

Select an option

Save mrcnc/e252ea829ed80316f2001de4c6eabfb6 to your computer and use it in GitHub Desktop.
Installing Boundless Exchange for development on macOS/OS X

First install exchange using a Python 2.7 enviroment (Python 3 is not supported yet)

git clone git@github.com:boundlessgeo/exchange.git
cd exchange
git checkout v1.3.0
# using pip 9.0.1 from /Library/Python/2.7/site-packages
pip install virtualenv
virtualenv .venv
source .venv/bin/activate

Next, install the dependencies

Note: since Exchange depends on many C(++) libraries, the installation process will be platform specific.

OS X

  1. GDAL install
# I already had a version of GDAL installed (1.11.5) that I had to uninstall with 
brew uninstall --ignore-dependencies --force gdal
brew tap osgeo/osgeo4mac
brew install gdal2
# then to add it to my path i did this
echo 'export PATH="/usr/local/opt/gdal2/bin:$PATH"' >> ~/.profile
  1. GEOS install

Because the 1.8 version of Django is incompatible with newer versions of GEOS, you may need to downgrade your version of GEOS. I was able to do that by running the following commands:

brew unlink geos
brew install https://gist.githubusercontent.com/mrcnc/fdd218cadf207d6797cb68422ac4d0f0/raw/866febe47f561f62e13cde434a301d0242b05cfe/geos.rb

Once the platform specific binaries are installed, you can use pip to install the dependencies:

pip install -r requirements.txt

Django setup

Exchange is a Django application, so be sure to read the docs to learn more about developing with Django. We like Docker for portability but there really is no need to develop inside of a container. The host system should be able to run and debug Exchange like any other Django app.

First you should setup the database and set the environment variable so you can access it from your host machine.

docker-compose up -d database
export DATABASE_URL='postgis://exchange:boundless@localhost:54320/exchange'

Then you can run these commands to setup and run the application.

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Now you should be able to login at http://localhost:8000/account/login/ with the superuser you created in the above steps.

Debugging

You can create a debug configuration in PyCharm to debug Exchange in the IDE. Just make sure to use the correct virtual environment (where you previously installed the dependencies) and set the DATABASE_URL environment variable to the appropriate url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment