Skip to content

gabicavalcante/flask-blueprint

Repository files navigation

flaskblueprint

Build Status Code Coverage

This is a simple flask blueprint, to help you to start a new project with a few importants features.

makefile

We made a makefile to help you with you setup project. Check the file to see all commands availables.

python code formartter

  • black
  • flake8
  • pre-commit: the file .pre-commit-config.yml is a file to configure git hooks for identify simple issues before submit a commit. Run pre-commit install to set up the git hook scripts. After that, pre-commit will run automatically on git commit.

libs

coverage report

continuous code quality

setup

create and configure .env file

$ cp .env.sample .env

add the env vars:

FLASK_APP=flaskblueprint.app:create_app
SECRET_KEY="..."
FLASK_ENV=development

create and configure .secrets.toml

$ cp .secrets.toml.sample .secrets.toml
[default]
CSRF_SESSION_KEY = ""
JWT_SECRET_KEY = ""

configure the .settings.toml

Open the .settings.toml file and check all variables. See if you want change any thing. I set the SQLALCHEMY_DATABASE_URI to connect with the mysql credentials that I defined in docker-compose file. If you change one of these files, remenber to change other.

run

docker-compose

You can run the app using the docker-compose file.

$  docker-compose up --build

flask run

virtualenv

# virtualenv
$ virtualenv -p python3 env
$ source env/bin/activate
# pyenv
$ pyenv virtualenv 3.7.4 flaskblueprint
$ pyenv activate flaskblueprint

install requirements

$ cd flaskblueprint
$ pip install -r requirements-dev.txt

note: requirements-dev.txt has all requirements packages to test, coverage and lint. If you don't want this packages, just run pip install -r requirements.txt.

migrate

$ flask db init
$ flask db migrate
$ flask db upgrade

run

$  flask run

tests

Start the test db:

$  docker-compose up database-test

To run tests with coverage

$  pytest --cov=flaskblueprint

references

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published