Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.94 KB

README.md

File metadata and controls

64 lines (48 loc) · 1.94 KB

vesialue-back

Vesialueen inventointi-ilmoitus backend

Production branch: main

  • Tests
  • codecov

Staging branch: staging

  • Tests
  • codecov

Heroku

There are GitHub Actions building and pushing the Docker containers to Heroku on each commit to main and staging branches

Installation

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

Testing

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

Building image

docker build -t vesialue-back .

Running image locally

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.