Bare minimum starter template using Flask and SQLAlchemy.
- python 3.6 +
- Pipenv for dependency management
- Clone this repository
- Copy
.env.example
to.env
and modify the required values. - Rename the
flask_sqlalchemy_starter
folder to your package name. - Add/remove models
- Create migrations using
flask db migrate
- Apply migrations to database using
flask db upgrade
- Run tests with
pytest -v tests
You can use any SQLAlchemy compatible URI string for the database. By default, the template uses a SQLite database.
To use a different database like Postgres, edit the DATABASE_URI
accordingly and install the appropriate python
package to connect to the DB.
- Run
pipenv install psycopg2
- Edit
DATABASE_URI
topostgres://<user>:<password>@<host>:5432/<database>
- Run
pipenv install mysql-connector
- Edit
DATABASE_URI
tomysql://<user>:<password>@<host>:3306/<database>