Vesialueen inventointi-ilmoitus backend
There are GitHub Actions building and pushing the Docker containers to Heroku on each commit to main and staging branches
Create a virtual environment and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r ./requirements.txt
Provide environment variables by creating an .env
file at the root of the project:
MONGO_URI=<MongoDB URI>
SECRET_KEY=<encryption key>
BIG_DATA_API_KEY<big data geo api key>
FLASK_APP=src/app.py
FLASK_ENV=development
In the virtual environment, start the server from the root of the project in development mode by running:
flask run
Provide additional environment variables in .env
file created before:
TEST_MONGO_URI=<MongoDB URI>
Run tests and collect coverage report:
FLASK_ENV=test coverage run -m pytest
docker build -t vesialue-back .
docker run --rm -p 3000:3000 vesialue-back
The service will be available at port 3000.
The port can be specified using the PORT environment variable (used when running on Heroku). The default is 3000.