unt-libraries / texas-choropleth

A Django project for generating choropleth maps of the state of Texas
http://texaschoropleth.org
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Texas Choropleth

PLEASE NOTE: This project is no longer under development

A Django project for creating and sharing interactive choropleths maps of the state of Texas.

Dependencies:

Quickstart

If you are just are interesting in taking this project for a test drive.

  1. Install Docker

  2. Install Docker Compose

  3. Clone the repository and enter the project directory and touch secrets.json

    $ git clone https://github.com/unt-libraries/texas-choropleth.git
    $ cd texas-choropleth
    $ touch secrets.json
  4. Add the following to secrets.json

    {
      "SECRET_KEY": "your-super-secret-key-here"
    }
  5. Run

    $ docker-compose build

    This will pull down the MySQL and Python images and build the web image from the Dockerfile.

  6. Run

    $ docker-compose run --rm web fab build_dev

    This will build the application.

  7. Run

    $ docker-compose run --rm web fab manage:createsuperuser
  8. Run

    $ docker-compose up -d

    This brings up the web and database containers and starts the application.

  9. Navigate to <dockerhost>:8000 and start using the app.

Host your own

Installation

Note: Configuring the web server and database is outside scope of the following instructions.

  1. Clone the repository

    $ git clone https://github.com/unt-libraries/texas-choropleth.git
  2. Create a virtualenv

    $ virtualenv ENV
  3. Activate the virtualenv then enter the project directory

    (ENV)$ source ENV/bin/activate
    (ENV)$ cd texas-choropleth
  4. Install the project dependencies

    (ENV)$ pip install -r requirements.txt

Pre-build

Before you build the project, you must define a secrets.json file in side the project root.

(ENV)$ touch secrets.json

The local.py settings only uses the SECRET_KEY, as the database settings preconfigured to work with Docker, but the production.py settings file also requires that the database settings are included.

Here is an example of what the secrets.json file should look like.

{
  "FILENAME": "secrets.json",
  "SECRET_KEY": "some-super-secret-key",
  "DB_NAME": "texas_choropleth",
  "DB_USER": "your_db_user",
  "DB_PASSWORD": "your_db_password",
  "DB_HOST": "db",
  "DB_PORT": "3306",
  "EMAIL_HOST": "your.email.host",
  "EMAIL_PORT": "",
  "EMAIL_HOST_USER": "user",
  "EMAIL_HOST_PASSWORD": "password",
  "EMAIL_USE_TLS": "",
  "EMAIL_USE_SSL": "",
}

Building

Run

(ENV)$ fab build_prod

in the project root. (The same directory where fabfile.py is)

What will this do?

Then run

(ENV)$ ./src/manage.py createsuperuser 

to create a site administrator

Important locations

Static files will be at <project_root>/src/static_final

Media files will be at <project_root>/src/media

Development

Environment

See Quickstart

Running Tests

There is a fabric task for this. If using Docker and Docker Compose:

$ docker-compose run --rm web fab run_tests

to run all tests

To run app specific tests

$ docker-compose run --rm web fab run_tests:<app-name>