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

A digital commendation system being developed for credits and to replace the one in use currently

License

Notifications You must be signed in to change notification settings

mmoomocow/digital-commendations

Repository files navigation

Digital Commendations

Code style: black DeepSource

A digital commendation system being developed for use at Bayfield High School

⚠️ PROJECT ARCHIVED ⚠️

This project has been archived for now as I have completed my assessments. At some point I might return to this and keep working on it.

Install Instructions

This project requires Python 3.10 or higher!

Cloning the repo

Clone the repository using git

git clone https://github.com/mmoomocow/digital-commendations.git

or download from the GitHub releases

Installing the virtual environment

Create a virtual environment using VENV.

python -m venv venv

Activate the virtual environment

with windows:

<venv path>\Scripts\activate.bat

Install the dependencies

pip install -r requirements.txt

If you are going to generate dummy data for the database, also install faker

pip install faker

Configuration

Create a .env file in the root directory of the project and add the following variables:

  • ALLOWED_HOSTS - A comma separated list of the allowed hosts

    • Example: *,localhost,www.example.com
  • Secret key - A secret key used to encrypt and decrypt data

    • Example: <random string>
  • DEBUG - A boolean value indicating if the application should be in debug mode

    • Example: True
  • SECURE_HSTS_SECONDS - The number of seconds that the browser should remember that the site is HTTPS only

    • Example: 31536000
  • PRODUCTION - A boolean value indicating if the application should run in production mode

    • Example: True
  • ADMINS - A comma separated list of admins who will receive emails for 500 errors

  • MANAGERS - A comma separated list of managers who will receive emails for 404 errors

  • DB_NAME - The name of the MySQL database schema to use

    • Example: commendations
  • DB_USER - The username to use to connect to the MySQL database

    • Example: root
  • DB_PASSWORD - The password to use to connect to the MySQL database

    • Example: password123
  • DB_HOST - The hostname of the MySQL database server

    • Example: localhost
  • DB_PORT - The port of the MySQL database server

    • Example: 3306
  • CONN_MAX_AGE - The number of seconds a database connection should be kept alive

    • Example: 60
  • KAMAR_AUTH_USERNAME - The username that the Kamar API will use to access the site

    • Example: Kamar
  • KAMAR_AUTH_PASSWORD - The password that the Kamar API will use to access the site

    • Example: password
  • MY_HOST - The hostname of the site. Used for redirect callbacks

    • Example: localhost:8000
  • MICROSOFT_AUTH_TENANT_DOMAIN - The domain of the Microsoft tenant

    • Example: example.com
  • MICROSOFT_AUTH_CLIENT_ID - The client ID of the Microsoft application

    • Example: 12345678-1234-1234-1234-123456789012
  • MICROSOFT_AUTH_CLIENT_SECRET - The client secret of the Microsoft application

    • Example: 1234567890123456789012345678901234567890

Migrate the database

python manage.py migrate

Generate dummy data (optional)

python manage.py populate_DB

Run the application

python manage.py runserver

Development

New Branches

Branches are used to track changes to the code. When a new branch is created, the name should be in the format of <name>-DCS-<cardID>. For example, Jdoe-DCS-123. The card ID is taken from the trello board.

Testing

To test the application, run the following command:

python manage.py test

As the project is developed, add new tests to the corresponding tests.py file.