This is a Django-based web application for managing employee clock-in and clock-out with a simple authentication system for managers and employees.
- Login: Separate login options for managers (unique password) and employees (shop-wide passcode).
- Manager Dashboard: Managers can view employee data and access management features.
- Employee Clock-In: Employees can clock in and clock out easily.
- Python 3.10 or higher
- Django 3.2 or higher
-
Clone the repository:
git clone [email protected]:0x3F-Lab/clock-in-system.git cd clock-in-system
-
Duplicate env for use:
cp src/.env.development src/.env
NOTE: Please modify the database password in the
.env
file! -
Start the containers:
cd src docker-compose up --build
The site is hosted at
http://localhost:8000
while the database is located athttp://localhost:5432
. NOTE: This will automatically apply all migrations to the database on all startups. -
Setting up virtual environment
python -m venv venv source ./venv/bin/activate pip install -r ./src/django/requirements.txt
This is not strictly needed, it is purely for inserting the required values into the database.
-
Setting up pre-commit (Developing)
This will setup the linting process client side before pushes are made to the remote repo. This ensures ease of use for all users without having to re-push with updated linting.
pip install black pre-commit pre-commit install # Run in root directory
This page makes accessing the database significantly easier as it directly integrates with the connected models. First, a superuser must be created for a login account.
# Ensure the `Django` container is running.
docker exec -it Django bash
cd /app
python manage.py createsuperuser
exit
Then, go to http://localhost:8000/admin/
and use the newly created account to log in.
For proper testing, the requirements are required to be installed, preferably with a virtual envrionemnt.
python -m venv venv
source ./venv/bin/activate
pip install -r ./src/django/requirements.txt
The tests conducted will use a dummy database as a substitute for the Postgres database. Specifically, it will use an in-memory SQLite3 database.
cd ./src/django
pytest
Make an environment to keep the requirements seperate from you system requirements. Ensure to do this in the project's root directory.
python -m venv venv
source ./venv/bin/activate
Install exisiting requirements.
pip install ./src/django/requirements.txt
Add any extra requirements then freeze the current requirements to update the file.
pip freeze > ./src/django/requirements.txt
NOTE: Ensure that the compose containers are REBUILT! to include the new packages.