You must use Python 3.13 to run this project as we are using some very new typing features.
- Install Python 3.13
- Create a virtual environment (venv)
python3.13 -m venv venv
- Activate the virtual environment
- On Windows:
venv\Scripts\activate
(If using windows please use WSL, otherwise make commands will not work) - On Linux/Mac:
source venv/bin/activate
- On Windows:
- cd to the arkad folder
cd arkad
.- This is where the django project is located.
- Install the required packages:
pip install -r requirements.txt
- Create a public/private keypair for JWT signing
- With the names public.pem, private.pem, they should be in arkad/private folder
- This can be done with:
mkdir private openssl genpkey -algorithm RSA -out private/private.pem -pkeyopt rsa_keygen_bits:2048 openssl rsa -in private/private.pem -pubout -out private/public.pem
- Copy
example.env
to.env
(Both are in arkad folder)- This contains the default environment variables.
- Start the Postgres database if not running it locally.
docker compose up
(from the arkad folder)
- Create migrations:
python manage.py makemigrations
- Migrate the database:
python manage.py migrate
- Create the cache database
python manage.py createcachetable
- Run the server:
python manage.py runserver
- Open your browser and go to
http://127.0.0.1:8000/api/docs
to see the API documentation.
This backend uses django and postgres as the database
The API is documented at /api/docs
Required environment variables are:
- SECRET_KEY (Set this to a long secret value)
- DEBUG (Must be set to "False" in production)
- POSTGRES_PASSWORD (The postgres database password for the user arkad_db_user)
If testing locally using docker debug should be True.
Can be built using: docker compose build
Ran with: docker compose up
When deploying you must set DEBUG environment value to False. Also make sure to set a secure secret key as it is otherwise possible to high-jack sessions. You should also set a good postgres password.
Enter the bash with: docker compose run web bash
Enter the shell utility: python manage.py createsuperuser
Follow the instructions.
It is possible to automatically update the database with new information about all companies.
For example jobs, if they have studentsessions etc.
This is done by running python manage.py jexpo_sync --file /path/to/jexpo.json
Migrations files are excluded from ruff formatting and are only checked to be legal by mypy.
- app/migrations/*.py
Test files are excluded from typing rules but are required to be valid code and formatting is applied.
- tests/*
- */tests.py
api files are not required to have typed return values.
- */api.py
Run the linting by standing in arkad and writing make lint
Run tests using python manage.py test
When pushing linting and tests will be run automatically. And when a new commit is added to master it is auto deployed.