Flask_boilerplate

screenshot of Flask_boilerplate

simple flask restful boilerplate

Overview

The Flask Restful Boilerplate is a simple boilerplate for creating Flask Restful applications with SQLAlchemy. It provides a structured starting point for building RESTful APIs with Flask, including features such as database migrations, resource creation, Swagger documentation, error logging, and more.

Features

  • Flask Restful App: Easily create Flask Restful applications.
  • SQLAlchemy Migrations: Migrate your database using the python manage.py migrate command.
  • Resource Creation: Generate new resource folders using the python manage.py resource <name> command and register their URLs in the corresponding urls.py file.
  • Blueprint Registration: Register all resources' blueprints in the root urls.py file of your project.
  • Schema Creation: Create schemas in the schema folder and use @marshal_with and @use_kwargs decorators for proper Swagger documentation. Access Swagger documentation at http://localhost:5000/docs/.
  • Utils and Constants: Create utility functions in the common/utils.py file and define constants in common/const.py.
  • Error Logging: Log errors in a file using app.logger.error(<any_other_function>()) in your code. Import from flask import current_app as app for app access.
  • Response handling: Send responses using the Response class from common/response.py.

Summary

The Flask Restful Boilerplate provides a convenient starting point for building Flask Restful applications with SQLAlchemy. It includes essential features such as database migrations, resource creation, Swagger documentation, error logging, and more. By following the installation guide and leveraging the provided features, developers can quickly set up and develop RESTful APIs using Flask.