![]() Here is a UML diagram to show the functions used in the API that will depend on the database schema:įlask app invoked functions depending on the Book table. The Flask API will use these fields as the data model for the CRUD operations. These fields will be stored in the database via the SQLAlchemy ORM. The design of this project is simple: We have a single table called books that stores the books fields: ISBN (of the book), title, author, and price. The schema is the metadata structure of the database, while the tables are the actual data that we want to store. SQLAlchemy is a Python ORM (Object Relational Mapping) library that makes it easy to work with databases.īefore creating the database, we need to define the database schema and the tables. In this tutorial, I've used the Flask-SQLAlchemy extension to create a database and a table for storing books. You can use Flask's extensions whenever you want to use something like the ORM (Object Relational Mapping) in your application. Being lightweight does not mean that Flask is not powerful. It is a very lightweight framework that is easy to learn and use. The code will be based on Flask and Flask-SQLAlchemy extension.įlask is a microframework for building web apps using Python. There is part two of the tutorial where we complete building the app by adding the frontend code using Jinja2 and Bootstrap check it here.īuilding a bookshop app is helpful for learning because it's a real example, not a toy project. We will define services to handle the CRUD operations GET, POST, PUT, and DELETE requests for the RESTful bookshop API. In this tutorial, you will learn how to build a CRUD application in Flask, and the result will be a working backend for a bookshop web application. ![]() It is a prevalent task in web development and very useful for learning how to build web apps. ![]() ![]() A CRUD app is a web app that allows you to create, read, update and delete things. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |