Importing Flask
Most used import functions
These are some of the most used import functions by flask developers
Boilerplate code
This is the basic template or barebone structure of a Flask app
Creating a route
This is to make different endpoints in our flask app.
Setting Allowed methods
Used to specify which methods are allowed for a request. Allowing get and post requests on an endpoint.
Re-run while coding
This is used to automatically rerun the program when the file is saved.
Change host
This is used to change the host.
Change port
This is used to change the port.
Importing SQLAlchemy
Database URI
This is the database's address.
or
Initialization
This is used to initialize SQLAlchemy.
Creating a Model
Class used to get data from the database and to send data to the database.
Get all data - all() method
This is used to get all the data from the database.
Filtered data - first() method
This is used to get the first dataset from the list returned by the filter_by function. You can get targetted data by this.
Send/add data to database
This is used to send/add data to the database.
Delete data from the database
This is used to delete data from the database.
Request method
This is used to know what request is made (get/post).
Render Template
This is used to pass and render an html file directly.
Solving FSADeprecationWarning
SQLALCHEMY_TRACK_MODIFICATIONS
allows you to disable the modification tracking system using this line:
Creating Database files
This is used to create database files
Method to return database items
This is used to return database items.
Printing returned content from the method
This is used to print returned database items.
Flask Documentation
Visit the Flask documentation here
Flask SQLAlchemy Documentation
Visit the Flask SQLAlchemy documentation here