create .env
file, edit the file as follows.
# .env
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=123456
MYSQL_DB=rest
python manage.py initdb
python manage.py init-user
flask run
python manage.py test
Use flask_restful framework to implement RESTful style api
This essay introduce how to use Marshmallow library to serialize and deserialize.
marshmallow is an object serialization/deserialization library, you can use it to format your response ouput and to validate form fields in an easy way.
Use Flask.config.from_object
set config from an ojbect, and to better manage environment variables, I use python-dotenv to load env variables from .env
file.
flask_sqlalchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy with Flask by providing useful defaults and extra helpers that make it easier to accomplish common tasks.
Flask-JWT-Extended’s Documentation
difference between refresh token and access token
Unit testing framework flask test 【Flask 教學】實作 Flask 單元測試 Unit Test
flask-restful-custom-error-handling
jinlygenius/flask_structure_example
- i18n
- cors
- middlewares