24
loading...
This website collects cookies to deliver better user experience
Gained basic Python programming concepts. You can check the python basics Here.
Learnt how to develop real-world Python applications.
Learnt how Python object-oriented programming can be applied to develop software more effectively Here.
Learnt how to develop Python functions, and how to use flow control statements in python. Check it Here.
Been able to apply Python programming techniques in specific fields such as Web Development, Data Science, Machine Learning, and AI.
pip install virtualenv
$ mkdir app
$ cd app
$ virtualenv venv
$ venv/bin/activate
$ venv\scripts\activate
$ pip install flask
from flask import Flask
app = Flask(__name__) #creating the Flask class object
@app.route('/') #decorator
def home():
return "Hello world";
if __name__ =='__main__':
app.run(debug = True)
To build the python web application, we need to import the Flask module. An object of the Flask class is considered as the WSGI application.
We need to pass the name of the current module, i.e. name as the argument into the Flask constructor.
The route() function of the Flask class defines the URL mapping of the associated function. The syntax is given below.
app.route(rule, options)
app.run(host, port, debug, options)