- Introduction
- Hello World
- Route
- DynamicRoute
- HTTPMethods
- GET
- POST
- PUT
- DELETE
- Variable-Rule
- String
- Integer
- Float
- URL-Redirection-in-Flask
- Simple-Redirect
- url-for()FunctioninFlask
- RedirectAndErrors
- ErrorWithAdmin
- BadRequestError
- Forbidden
- StaticFileUses
- SendDataFromTemplate
- Cookies
- PortAndIPAddress
- Port
- IPAddress
The Tutorial Describes the Basics of the Flask Framework in Python. It designed Basic Flask Applications For Learning.
Hello World is the basic application in flask to Print the Hello World on the Screen.
To View Outcome
Navigate the Project Directory cd Hello World
Create the Virtual Environment python -m venv venv
Activate the Environment on Windows .\venv\Scripts\activate
Install the Flask FrameWork pip install flask
Execution Process Navigate to the cd Hello World/App
.\app.py on the Terminal.
Route is The Basic Routing using Flask Application. Using the Specified the Route Parameter as (/hello).
For Outcome follow the Steps mentioned Above, After the Below Directory.
Navigate the Project Directory cd Route
Dynamic Route is used to Route the Page and it's Information Based on the Specified User like (/user/).
For Outcome follow the Steps mentioned Above, After the Below Directory.
Navigate the Project Directory cd Dynamic Route
we will learn how to handle HTTP methods, such as GET and POST in Flask using Python. Here, we will understand the concept of HTTP, GET, and HTTP POST, and then we will the example and implement each in Flask. Before starting let’s understand the basic terminology:
GET: to request data from the server.
To Request the Page Using GET Method in Python Flask.
For Outcome follow the Steps After the Below Directory.
Navigate the Project Directory cd HTTP Methods\GET
Create the Virtual Environment inside it. python -m venv venv
navigate to the Environment Directory using .\venv\Scripts\activate
Install the Flask FrameWork pip install flask
To Run the Application Using .\app\app.py
POST: to submit data to be processed to the server.
To Request the Page Using POST Method in Python Flask.
For Outcome follow the Steps After the Below Directory.
Navigate the Project Directory cd HTTP Methods\POST
Create the Virtual Environment inside it. python -m venv venv
navigate to the Environment Directory using .\venv\Scripts\activate
Install the Flask FrameWork pip install flask
To Run the Application Using .\app\app.py
PUT: A PUT request is used to modify the data on the server. It replaces the entire content at a particular location with data that is passed in the body payload. If there are no resources that match the request, it will generate one.
To Request the Page Using PUT Method in Python Flask.
For Outcome follow the Steps After the Below Directory.
Navigate the Project Directory cd HTTP Methods\PUT
Create the Virtual Environment inside it. python -m venv venv
navigate to the Environment Directory using .\venv\Scripts\activate
Install the Flask FrameWork pip install flask
To Run the Application Using .\app\app.py
To See the Value Changes Refresh Once the Data is Submitted By HTML Form.
DELETE: A DELETE request is used to delete the data on the server at a specified location.
To Request the Page Using DELETE Method in Python Flask.
For Outcome follow the Steps After the Below Directory.
Navigate the Project Directory cd HTTP Methods\DELETE
Create the Virtual Environment inside it. python -m venv venv
navigate to the Environment Directory using .\venv\Scripts\activate
Install the Flask FrameWork pip install flask
To Run the Application Using .\app\app.py
The Variable-Rule Defines the DataType Specified by the Dynamic URL's on the Flask Framework.
The String Variable Represents the Type of the URL Should be on Letters normally
Enter the Navigation string/yourname to see the magic route.
The Integer Variable Represents the Type of the URL Should be on Numbers only.
Enter the Navigation integer/yourage to see the magic route.
The Float Variable Represents the Type of the URL Should be on Decimal Points
Enter the Navigation string/yourvalletbalance in float to see the magic route.
Redirect the Home Page By URL in Flask.
Redirect the (/) Route to the (/helloworld) from the Home Page in Flask.
Redirect the (/) Route to the (/admin) Or (/user/username) to view the Result or else click the Link from Home Page.
The URL Redirects Using the "Redirect" Class From Flask based on the Method POST or GET.
The ErrorsWithAdmin is to Check Weather the User Enters the Username as the "Admin" then Sucess Message will Show Otherwise the Default Route will Work.
The Error message will display when the User Enters the name with numbers it will Display the Following Error. (Error Code 400).
The Error message will display when the User Enters the name with numbers it will Display the Following Error. (Error Code 403).
The Program contains the Static Folder in it's app directory to understand the JavaScript and CSS files how it is calling through the Flask Framework.
Send the data from the HTML Form data to Template in the Table Format.
The cookies are used to add the entries in the fields to remember the user. Here we describe the feature in the flask.
To change the current local IP and port address to the system network IP To find the IP address running on your system, use the command below to get the IP address. ipconfig
The Port will be changed using the specified set of values in the Python function.
The IP address will be changed using the specified set of values in the Python function.