This is a simple flask blueprint, to help you to start a new project with a few importants features.
We made a makefile
to help you with you setup project. Check the file to see all commands availables.
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. Runpre-commit install
to set up the git hook scripts. After that,pre-commit
will run automatically ongit commit
.
- config:
dynaconf
- dynaconf a layered configuration system for Python applications. It's a great libary to manager the configuration files of your Python Project.
- admin:
flask_admin
- Build an admin interface on top of yours data models.
- auth:
flask_simplelogin
- commands:
click
- You can create commands with click to simplify tasks.
- tests:
pytest
- token:
flask_jwt_extended
- log:
logging
- db:
flask_sqlalchemy
andflask_migrate
- appearance:
flask_bootstrap
$ cp .env.sample .env
add the env vars:
FLASK_APP=flaskblueprint.app:create_app
SECRET_KEY="..."
FLASK_ENV=development
$ cp .secrets.toml.sample .secrets.toml
[default]
CSRF_SESSION_KEY = ""
JWT_SECRET_KEY = ""
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.
You can run the app using the docker-compose file.
$ docker-compose up --build
# virtualenv
$ virtualenv -p python3 env
$ source env/bin/activate
# pyenv
$ pyenv virtualenv 3.7.4 flaskblueprint
$ pyenv activate flaskblueprint
$ 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
.
$ flask db init
$ flask db migrate
$ flask db upgrade
$ flask run
Start the test db:
$ docker-compose up database-test
To run tests with coverage
$ pytest --cov=flaskblueprint