Skip to content

Latest commit

 

History

History
69 lines (39 loc) · 1.78 KB

README.md

File metadata and controls

69 lines (39 loc) · 1.78 KB

IT Assets System

This project consists of a Django application used by the Department of Biodiversity, Conservation and Attractions to record and manage IT assets and analytics.

Installation

The recommended way to set up this project for development is using Poetry to install and manage a virtual Python environment. With Poetry installed, change into the project directory and run:

poetry install

Activate the virtualenv like so:

poetry shell

To run Python commands in the virtualenv, thereafter run them like so:

python manage.py

Manage new or updating project dependencies with Poetry also, like so:

poetry add newpackage==1.0

Environment variables

This project uses confy to set environment variables (in a .env file). The following variables are required for the project to run:

DATABASE_URL="postgis://USER:PASSWORD@HOST:PORT/DATABASE_NAME"
SECRET_KEY="ThisIsASecretKey"

Running

Use runserver to run a local copy of the application:

python manage.py runserver 0:8080

Run console commands manually:

python manage.py shell_plus

Unit tests

Start with pip install coverage. Run unit tests and obtain test coverage as follows:

coverage run --source='.' manage.py test -k
coverage report -m

Docker image

To build a new Docker image from the Dockerfile:

docker image build -t ghcr.io/dbca-wa/it-assets .

Pre-commit hooks

This project includes the following pre-commit hooks:

Pre-commit hooks may have additional system dependencies to run. Optionally install pre-commit hooks locally like so (with the virtualenv activated first):

pre-commit install

Reference: https://pre-commit.com/