Newer
Older
1. Set up a PostgreSQL database (version 12) manually by downloading it from https://www.postgresql.org/download/. If necessary, adjust the URI in your .env file located at `mcserver/.env`.

Konstantin Schulz
committed
3. Run `python app.py`.
## Endpoints
The default starting point for the API will be at http://localhost:5000/mc/api/v1.0/corpora .
----------------------------------------------------------------
# Configuration
For general configuration, use the file `mcserver/config.py`.
To customize sensitive parts of your configuration, edit the `.env` file in the `mcserver` directory.
----------------------------------------------------------------
# Dependencies
To update outdated dependencies, find the relevant ones by running: `pip list -o`
Then, for each of the listed dependencies, run: `pip install -U <DEPENDENCY_NAME>`
Then, for each of the listed dependencies, run: `pip install -U <DEPENDENCY_NAME>`
Or combine both commands in one line: `pip list -o --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U`
----------------------------------------------------------------
# Database
To autogenerate a new migration script:
1. Start the Docker container with the database: `docker compose up -p 5432:5432 -d db`
2. Create a new migration: `flask db migrate`.
3. Perform a migration...
- ... to a newer version: `flask db upgrade`.
- ... to an older version: `flask db downgrade`.
- If it does nothing or fails, make sure that the environment variable FLASK_APP is set correctly (see https://flask.palletsprojects.com/en/1.1.x/cli/): `export FLASK_APP=app.py`
5. To finish the process, shut down the database container: `docker compose down`
----------------------------------------------------------------
# Models
To generate class structures for this project automatically:
1. Install OpenAPI Generator (using, e.g., `brew install openapi-generator`).
2. Run: `openapi-generator generate -i ./mcserver/mcserver_api.yaml -g python-flask -o ./openapi/ && python openapi_generator.py`.
# Testing
To check the coverage of the current tests, run
`coverage run --rcfile=.coveragerc tests.py && coverage combine && coverage report -m`.