First Flask application
First Flask application
- We will build our first python website built using the Flask framework. To Write the following code and save to a file named as script.py.
Sample code
- To run this python code on the command line and To check the result.
Output
- It is to be run to on the browser.
Output
- To build our python web application, we used to import the Flask module.
- route() function - The Flask class defines the URL mapping of the associated function.
Read Also
Syntax
app.route(rule, options)
Approute
- Rule - Represents the list of parameters to be associated with the rule object.
- Options - Represents the URL binding with the function.
The run method of the Flask class is used to run the flask application on the local development Server.
Syntax
app.run(host, port, debug, options)
Run Method
- Host - The default hostname is 127.0.0.1.
- Port - The port number to which the server is listening to. The default port number is 5000.
- Debug - The default is false. It provides debug information if it is set to true.
- Options - It contains the information to be forwarded to the server.
If you want to learn about Python Course , you can refer the following links Python Training in Chennai , Machine Learning Training in Chennai , Data Science Training in Chennai , Artificial Intelligence Training in Chennai