Flask Cheatsheet
Importing Flask
Most used import functions
These are some of the most used import functions
Boilerplate
This is the basic template or barebone structure of Flask.
route(endpoint)
This is to make different endpoints in our flask app.
Route method
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.
SQLAlchemy
Database URI
This is the database's address.
Initialization
This is used to initialize SQLAlchemy.
Creating Model
Class to get data from database and to send data to the database.
Get all data(.all())
This is used to get all the data from the database.
Filtered data(.first())
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 whole html file directly.
FSADeprecationWarning
Creating Database file
This is used to create a database file
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.
Comments
Post a Comment