Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Installation & Setup

Benjamin Golder edited this page Jul 15, 2021 · 21 revisions

Requirements

To get a local version of intake running, you'll need to have the following installed:

You may encounter issues when installing Python 3.6.8. The most recent solution we've found is on Stack Overflow.

brew install pyenv
brew reinstall zlib bzip2

Add the following lines to your .bash_profile, .zshrc or similar shell config

# Load pyenv automatically
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PATH="/usr/local/bin:$PATH"

eval "$(pyenv init --path)"
eval "$(pyenv init -)"

export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"

Install Python 3.6.8

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.8 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)

If you are using pyenv then in the terminal python will refer to whichever version of python is currently set by pyenv.

  • OpenJDK 8: OpenJDK is the open source version of Java
brew tap adoptopenjdk/openjdk
brew install adoptopenjdk8 --cask

You may have a newer version of OpenJDK or Java already installed on your machine. You will need to uninstall all other versions of OpenJDK and Java. Check that you have the correct version with

java -version

Installation

Installation quick-start steps:

git clone https://github.com/codeforamerica/intake.git
cd intake
pyenv local 3.6.8
python -m venv .venv
source .venv/bin/activate
make install

Note: The installation will require OpenJDK - make sure you download OpenJDK 8, since newer releases break the included pdfparser.jar.

The virtual environment

Note that running

python -m venv .venv

Creates a folder in the current directory named .venv, which will contain files and folders for a python virtual environment, such as lib, include, share, and bin.

You may wish to create your virtual environment in a different location with a different name, for example:

python -m venv ~/envs/pyvenv36

or

python -m venv ./venv

If you use a different location or name, be sure to run source on the correct activate script. For example:

source ~/envs/pyvenv36/bin/activate

or

source ./venv/bin/activate

Running make install

The make install command installs two types of dependencies.

First it installs Python dependencies as described in requirements/dev.txt.

pip install -r requirements/dev.txt

Second, it installs npm dependencies listed in package.json (which are used for static asset processing).

npm install

Note: If you are having issues installing Pillow, try the following command

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Local settings

cp ./local_settings.py.example ./local_settings.py

Set up the database

Make sure you have a local PostgreSQL database, and that you know the login information. Add this database information to local_settings.py. If you're not sure how to setup a PostgreSQL database, here is a how-to guide.

For example, if I have a default user named postgres:

# create a database named "intake"
createdb intake
# in local_settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'intake',
        'USER': 'postgres',
    }
}

With the database connection information in place, the following command will migrate the database and add seed data:

make db.setup

Run the local server

The following command will spin up a local server at http://localhost:8000/

make serve

Updating CSS

The following command will watch SCSS files for changes and, once a change is detected, compile that SCSS into CSS for use in development and production.

make static.dev

To run this command, you will have to have the CLI SASS tools installed on your local machine. You can install with brew by running brew install sass/sass/sass.