Computational Mathematics event of PRIME.
The python dependencies are managed with uv go there and install it.
(If you have asdf, you can also run sh .asdf-plugins, asdf install, and asdf reshim instead.)
Install all the dependencies with:
uv sync
npm iActivate the virtual environment with:
source .venv/bin/activateCreate an .env file:
cp .env.sample .envThe defaults should suffice for development.
./scripts/run_dev.shThis will start a local development server on port 8000.
For a development database, either install Postgres, or use docker compose -f docker-compose.dev.yml up -d dev-db as mentioned below.
If you have docker compose installed, you can also use the docker-compose.dev.yml file.
Create it's own .env file:
cp .docker-env-dev.sample .docker-env-devStart the database using:
docker compose -f docker-compose.dev.yml up -d dev-dbStart the development webserver with:
docker compose -f docker-compose.dev.yml up --build -d dev-backend
docker compose -f docker-compose.dev.yml logs -f dev-backendYou can also start a development shell using:
docker compose -f docker-compose.dev.yml exec dev-backend bashThis will start a local development server on port 8000 (port 80 within the container).
To see and interact with the available endpoints, see http://localhost:8000/docs.
To format the python code in place, run:
./scripts/format.shAfter changing a model (for example, adding a column), create a revision:
alembic revision --autogenerate -m "Add column ..."After creating the revision, run the migration in the database (this is what will actually change the database):
alembic upgrade headOr in docker compose:
docker compose -f docker-compose.dev.yml exec dev-backend alembic upgrade headTo create an admin user in the dev database, run:
docker compose -f docker-compose.dev.yml exec dev-db psql coma coma -c"INSERT INTO team (name, password, admin) VALUES ('admin', 'admin', true);"To add some questions, run:
docker compose -f docker-compose.dev.yml exec dev-db psql coma coma <app/mock/2024_questions.sql