Skip to content

Omgevingsbeleid API was originally created in early 2018 in order to meet the requirements given by the new 'Omgevingswet' from the dutch national government.

License

Notifications You must be signed in to change notification settings

Provincie-Zuid-Holland/Omgevingsbeleid-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example .env

SQLALCHEMY_DATABASE_URI="sqlite+pysqlite:///api.db"

Running tests

Have .env with test database:

SQLALCHEMY_TEST_DATABASE_URI="sqlite+pysqlite:///api.db"

Go into pyenv and then install dependencies:

make local-env

Then run:

make test

sqlite

CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.10.13

@TODO: Fix below this

Provincie Zuid-Holland logo

Omgevingsbeleid API · License

OpenAPI Specification

Omgevingsbeleid API was originally created in early 2018 in order to meet the requirements given by the new 'Omgevingswet' from the dutch national government.

Stack

Setup

For development we currently support two setups:

Manual Installation

Dependencies

Ubuntu

Ubuntu users need unixodbc-dev to use the PyODBC package"

apt install unixodbc-dev

Installation

This project utilizes venv. Create a new venv.

python -m venv .venv

activate your new venv.

.venv/Scripts/activate

install the required packages.

pip install -r requirements.txt

Environment Variables

This application requires the following variables to be available

DB_USER= Database user that the application can use
DB_PASS= Password of the database user
DB_HOST= SQL-server host URI
DB_PORT= Port to use for connection to SQL-server (1433 default)
DB_NAME= Name of the database to use
DB_DRIVER= Database driver name to use
FLASK_APP= application.py
JWT_SECRET= 1234abahsge (random string)

When developing it is convencient to set the FLASK_ENV variable to enable auto reload debugging mode.

FLASK_ENV=development

To run the tests, the application requires a database with a test user in its user table. Ass the following variables

TEST_MAIL= Email address of the test user (in user table, optional)
TEST_PASS= Password of the test user (optional)
TEST_UUID= UUID of the test user (optional)

Running locally and running tests

In order to run your local project (requires a valid .env file).

flask run

To run the tests.

pytest

Running in docker

Dependencies for docker

  • minimum docker version 17.06.0+
  • minimum docker-compose version 1.27.0

To initialise the project you can run:

make init

This will start this python project as api, and it will also start the mssql database and frontend application. Goto localhost:8888 to view all the services working together.

Note: it can take a while to start as the frontend will be build in development mode.

Commonly used commands

make help # Shows the commonly used make commands with a small description
make init # The entrypoint: Starts docker, loads database and fills database with fixtures

make info # Shows information where all the applications can me accessed.
make api  # Sends you in the api container
make logs # Tails the docker-compose logs
make restart # Restarts the docker services and executes `init` afterwards
make restart-hard # Same as restart, but will also remove the current volumes
make test # Run the tests inside the docker container

Frontend Font Awesome dependency

In the frontend we currently have Font Awesome pro installed. To build the frontend you should provide a valid Font Awesome secret. The environment variable PZH_FONTAWESOME_SECRET should be known to docker-compose. This can be done by setting PZH_FONTAWESOME_SECRET in the .env file.

For example in the .env file:

PZH_FONTAWESOME_SECRET=font-awesome-secret-here

Use a different frontend branch

By default the dev branch of the frontend application will be used. You can overwrite the branch by setting the environment variable FRONTEND_BRANCH.

For example in the .env file:

FRONTEND_BRANCH=main

About

Omgevingsbeleid API was originally created in early 2018 in order to meet the requirements given by the new 'Omgevingswet' from the dutch national government.

Topics

Resources

License

Stars

Watchers

Forks