Skip to content

Startup Instructions (Windows)

Melelelelelelelel edited this page Nov 6, 2018 · 5 revisions

Note this page may be incomplete as I don't need to use Travis/pre-commit/etc. since I'm not dev-ing

Installing stuff

You will need to install the following:

Python 3.6

  1. Download & install Python 3.6
  2. From Terminal, make sure you have Python version 3.6 by running python --version

Git

  1. Download & install Git
  2. You may also want the GitHub GUI

Docker

  1. Make a Docker account (you'll need it to install Docker)
  2. Download & install Docker (note there's an option to use Windows or Linux containers (default), I used Linux and it seems to work fine)
  3. Run through the Docker tutorial (up to and including the Hello World portion)

Pipenv

  1. Clone the Git repository to your machine
  2. Install pipenv

Making sure it all works

Docker

  1. From the project directory, use Docker to build the project Dockerfile using the command docker build -t irs_db .
  2. Use Docker to run the container you just created using the command docker run --rm -p 5432:5432 irs_db
  3. Make a new Terminal and navigate to the project directory, then use pipenv to run pytest (see pipenv link above). This should cause changes in the container window as well
  4. If you need to use a local DB, open up a new terminal in the project directory and run psql -U postgres -c "DROP DATABASE irs" then psql -U postgres -c "CREATE DATABASE irs OWNER postgres"
  5. Run psql -U postgres irs < db/schema.sql and psql -U postgres irs < db/test.sql
  6. To use the DB with Flask, run psql -U postgres -h localhost -p 5432 < db/test.sql

Note that if you CTRL+C out of the Docker container, the process will still be running in the background. Using docker ps will show you if there is anything still running.

If a project container (eg. irs_db) is still running, you will be unable to run another container for this project (I think) until you stop it using docker stop [container id] where the container id is the one associated with the container to stop (use docker ps to find it).

Flask

  1. Navigate to the project directory and, from the pipenv shell, set the FLASK_APP environment variable using set FLASK_APP=web
  2. Make sure Docker is running the project container (I believe irs_db, though postgres seemed to work too), then run flask using flask run
  3. In your browser, go to the test site