Giter VIP home page Giter VIP logo

chi77's Introduction

Chi77

Together Chicago's data analytics platform.

Deployment

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.

Local development environment

To run this software on a development machine, ensure that you have the following tools installed:

  1. 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).
  2. Download and install the latest version of Python 3. Using Homebrew on the Mac:
$ brew install python3
  1. 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:

Option 1: Create a Dockerized server and 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.

  1. Start the Django application server and Postgres database using Docker Compose:
$ docker-compose up
  1. 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.

Option 2: Run Django natively and connect to the production database

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:

  1. Install the Geospatial Data Abstraction Library, GDAL. Using Homebrew on the Mac:
$ brew install gdal
  1. Use pip to install the application's dependencies:
$ pip3 install -r requirements.txt
  1. 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
  1. Start the Django server locally:
$ heroku local
  1. 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

Deployment to Heroku

Chi77 will run on the Heroku cloud. Configure your Heroku Dyno as follows:

Stack:
  • cedar-14 (App will not run on the default heroku-16 stack.)
Add-ons:
  • Heroku Postgres Database
Buildpacks:
  • https://github.com/cyberdelia/heroku-geo-buildpack.git
  • heroku/python
Config Variables:
  • BUILD_WITH_GEO_LIBRARIES = 1
  • DATABASE_URL = (URI of database)

chi77's People

Contributors

defano avatar karankwatra avatar

Watchers

 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.