Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Setting The App Up

Ben C edited this page Nov 10, 2021 · 16 revisions

THIS PAGE IS A WORK IN PROGRESS

Preface

This is a pretty long process and easy to mess up, so make sure you know how to use IIS and python beforehand

Dependencies

You'll need to install the following:

  • Git: To download the app
  • Python 3.9: To run the app
  • MySQL Server: To act as the database
  • IIS: To host the site
  • ActiveDirectory (can be on a different server): To authenticate with

Setting up the project folder

First and foremost, you need to download the code, navigate to the folder where you want the code to be downloaded and run the following:

git clone https://github.com/Bwc9876/CodeReview.git
cd CodeReview

This will download the app.
Next up, you'll want to create a python virtual environment to run the app in, you can do this by running the following:

python -m venv venv

This will create a new folder named "venv" in the app directory.
Now that we made the virtual environment, we need to activate it, this is done by running:

./venv/Scripts/activate.ps1

Now you should see (venv) in the current line, this indicated the environment was activated successfully.
Now we need to install dependencies, this is done by running:

pip install -r requirements.txt

In addition, run the following to install wfastcgi, which we use to host the app on IIS

pip install wfastcgi

Now we have our dependencies installed.

Setting up the environment

Now we'll need to setup environment variables, look at the environment variables section of the README for more info on what each one does.
Now, create a new file in the CodeReview folder named "env.ps1".
Fill it out in this format, replacing "KEY" with the environment variable's name and VALUE with it's value.

$Env:KEY=VALUE

Make a new line for each environment variable.
We have now set up our environment variables.

Database

Next up, we'll set up our database, start off by opening a new powershell window and navigating to the CodeReview folder and executing the following.

./venv/Scripts/activate.ps1
./env.ps1

Now, run the following to set up the database.

python manage.py migrate

This will create the necessary tables for the app.

Static files

Before closing the powershell window from the database section, run the following to copy static files to the proper folder.

python manage.py collectstatic

Say yes to any warnings about overriding old files.
We've now set up our static files.

Clone this wiki locally