Skip to content

MKargus0/online_fiducial_boards

Repository files navigation

Online fiducial boards generator

Online fiducial board generator. Generates manual boards and Sierpinski carpet fractal board. Used opencv Aruco as fiducials

Debug locally quickstart

Crate venv:

python3 -m venv venv

Activate virtual environment:

source venv/bin/activate

You can deactivate venv by using this command:

deactivate

Save/Update all lib to requirements.txt file:

pip freeze > requirements.txt

Install all libs from requirements.txt :

pip install -r requirements.txt

Install current package to environment

pip install -e .
npm install && npm run-script build

After installation run python debug for examples/start_app.py

Docker Quickstart

This app can be run completely using Docker and docker-compose. Using Docker is recommended, as it guarantees the application is run using compatible versions of Python and Node.

There are three main services:

To run the development version of the app

docker-compose up flask-dev

To run the production version of the app

docker-compose up flask-prod

The list of environment: variables in the docker-compose.yml file takes precedence over any variables specified in .env.

To run any commands using the Flask CLI

docker-compose run --rm manage <<COMMAND>>

Therefore, to initialize a database you would run

docker-compose run --rm manage db init
docker-compose run --rm manage db migrate
docker-compose run --rm manage db upgrade

A docker volume node-modules is created to store NPM packages and is reused across the dev and prod versions of the application. For the purposes of DB testing with sqlite, the file dev.db is mounted to all containers. This volume mount should be removed from docker-compose.yml if a production DB server is used.

Go to http://localhost:8080. You will see a pretty welcome screen.

Deployment

When using Docker, reasonable production defaults are set in docker-compose.yml

FLASK_ENV=production
FLASK_DEBUG=0

Therefore, starting the app in "production" mode is as simple as

docker-compose up flask-prod

If running without Docker

export FLASK_ENV=production
export FLASK_DEBUG=0
export DATABASE_URL="<YOUR DATABASE URL>"
npm run build   # build assets with webpack
flask run       # start the flask server

Shell

To open the interactive shell, run

docker-compose run --rm manage shell
flask shell # If running locally without Docker

By default, you will have access to the flask app.

Running Tests/Linter

To run all tests, run

docker-compose run --rm manage test
flask test # If running locally without Docker

To run the linter, run

docker-compose run --rm manage lint
flask lint # If running locally without Docker

The lint command will attempt to fix any linting/style errors in the code. If you only want to know if the code will pass CI and do not wish for the linter to make changes, add the --check argument.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published