/planningportal

A dashboard for SF Planning Department data

Primary LanguagePythonMIT LicenseMIT

SF Planning Portal

development

Prerequisites

  1. Install python3
  2. Install pip3 (on linux)
  3. Install pipenv

Linux:

sudo apt-get install -y python3 python3-pip
pip3 install --user pipenv

OSX:

brew install python3
brew install pipenv

Set up your local dev environment:

# Activate the virtual environment
pipenv shell
# Install depdendencies
make setup
# Open `.env` and edit as necessary.
# ...
# Set up your database
python manage.py migrate
python manage.py createsuperuser
# Get the planning data
make fetchdata
# Load your database
python manage.py loadppts data/<the ppts file>

Repo structure

This was created with [https://github.com/jpadilla/django-project-template]. Please see that repo's README for information on how this project is structured. Selected README sections are retained below:

Features

  • Django 2.0+
  • Uses Pipenv - the officially recommended Python packaging tool from Python.org.
  • Development, Staging and Production settings with django-configurations.
  • Get value insight and debug information while on Development with django-debug-toolbar.
  • Collection of custom extensions with django-extensions.
  • HTTPS and other security related settings on Staging and Production.
  • Procfile for running gunicorn with New Relic's Python agent.
  • PostgreSQL database support with psycopg2.

Environment variables

These are common between environments. The ENVIRONMENT variable loads the correct settings, possible values are: DEVELOPMENT, STAGING, PRODUCTION.

ENVIRONMENT='DEVELOPMENT'
DJANGO_SECRET_KEY='dont-tell-eve'
DJANGO_DEBUG='yes'

These settings(and their default values) are only used on staging and production environments.

DJANGO_SESSION_COOKIE_SECURE='yes'
DJANGO_SECURE_BROWSER_XSS_FILTER='yes'
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF='yes'
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS='yes'
DJANGO_SECURE_HSTS_SECONDS=31536000
DJANGO_SECURE_REDIRECT_EXEMPT=''
DJANGO_SECURE_SSL_HOST=''
DJANGO_SECURE_SSL_REDIRECT='yes'
DJANGO_SECURE_PROXY_SSL_HEADER='HTTP_X_FORWARDED_PROTO,https'