Together Chicago's data analytics platform.
Chi77 is a Python Django application communicating with a GIS-enabled Postgres database. It can be run locally on a developer's workstation or on the Heroku cloud.
To run this software on a development machine, ensure that you have the following tools installed:
- Download and install the latest version of Docker, then start the Docker agent on your machine (on Macs, a Docker icon will appear in the menubar when the agent is running).
- Download and install the latest version of Python 3. Using Homebrew on the Mac:
$ brew install python3
- Clone this repository to your local filesystem, then navigate into the repo's directory:
$ git clone https://github.com/togetherchicago/chi77.git
$ cd chi77/
Once these tools are installed you have two options for linking the application server to the database:
Runs the application server and database in a linked pair of Docker containers. Pros: Easy to setup. Cons: Takes longer to startup as all analysis data must be downloaded and processed locally before you can use the app.
- Start the Django application server and Postgres database using Docker Compose:
$ docker-compose up
- In a web browser, navigate to the app at
http://localhost:5000
Note that when running Django inside of Docker, a default Django admin user is automatically created. Log into the Django admin console at http://localhost:5000/admin
as user admin
with password test1234
.
Runs the application server natively (no use of Docker) and attaches to the Heroku-deployed database instance. Pros: Starts faster; has access to same datasets that the end user does. Cons: More complicated to initially get setup.
Ensure you have installed the Heroku CLI, then:
- Install the Geospatial Data Abstraction Library, GDAL. Using Homebrew on the Mac:
$ brew install gdal
- Use
pip
to install the application's dependencies:
$ pip3 install -r requirements.txt
- Export a
DATABASE_URL
environmental variable that holds the URI of the production database. Alternatively, this variable can be used to connect Django a local database instance, too. For example (the actual production URI cannot by published here, obviously):
$ export DATABASE_URL=postgres://username:password@host:port/db_name
- Start the Django server locally:
$ heroku local
- In a web browser, navigate to the app at
http://localhost:5000
If you need to log into the Django admin console you'll need to first create a default user: Execute the scripts/init_django.sh
script, then log into the console at http://localhost:5000/admin
as user admin
with password test1234
Chi77 will run on the Heroku cloud. Configure your Heroku Dyno as follows:
cedar-14
(App will not run on the defaultheroku-16
stack.)
- Heroku Postgres Database
https://github.com/cyberdelia/heroku-geo-buildpack.git
heroku/python
BUILD_WITH_GEO_LIBRARIES
=1
DATABASE_URL
= (URI of database)