Development-setup
Requirements
- Python
I just plan to support the most recent version of Python.
At least Python 3.10 - Caddy
- Pipenv
- Linux
- Docker
- pnpm (at least node 18)
Setup
- Clone the repo:
git clone https://github.com/mawoka-myblock/ClassQuiz
- Install the dependencies
- Python:
pipenv install -d
- JS:
cd frontend && pnpm i
- Python:
- Start the other services
There's a small helper-script: It's called
run_tests.sh
and does more than you think.run_tests.sh - Docs
You can run this script with bash. It helps you managing docker-containers you need to run ClassQuiz. The standard workflow is the following:
- Prepare all the containers:
./run_tests.sh +
- Start the Python-server:
pipenv run uvicorn classquiz:app --reload --proxy-headers
- Start the background worker:
pipenv run arq classquiz.worker.WorkerSettings
- Start the frontend-dev-server:
cd frontend && API_URL=http://localhost:8080 pnpm dev
- Start Caddy:
caddy run
- Start the background-worker:
arq classquiz.worker.WorkerSettings
If you're done developing:
./run_tests.sh -
If you want to run all the tests:
./run_tests.sh a
- Prepare all the containers:
- Add the following line to your
/etc/hosts
-file, so you can visit ClassQuiz viatest.com
(Required for the Captcha and Mapbox)
Now you can visit ClassQuiz athttp://test.com:8080.127.0.0.1 test.com
- Set your config up in your .env-file. What you have to set up can you see in the
classquiz/config.py
-file. The things you have to set are the following:hcaptcha_key
mail_address
mail_password
mail_username
mail_server
mail_port
secret_key
You'll have to set up the storage. For developing, I'd recommend using the local file system. to do that, set the following 2 environment-varialbes:
STORAGE_PATH=/tmp/storage
STORAGE_BACKEND=local
- Start the server
- Backend:
pipenv run uvicorn classquiz:app --reload --proxy-headers
- Frontend:
cd frontend && API_URL=http://localhost:8080 pnpm dev
- Backend:
Pre-Commit
We're using Pre-Commit for our pre-commit hooks. Install it by running the following command:
pipenv run pre-commit install
BEFORE you submit a Pull-Request
Please use Gitmoji for your commits.
Frontend
Please format and lint your code with
pnpm run format && pnpm run lint
Backend
Run the tests: ./run_tests.sh a