Posts

Showing posts from January, 2021

web application using Flask and deploy it to the cloud

Image
  web application using Flask and deploy it to the cloud How Does a Flask App Work? The code lets us run a basic web application that we can serve, as if it were a website. from flask import Flask app = Flask ( __name__ ) @app . route ( "/" ) def home ( ) : return "Hello, World!" if __name__ == "__main__" : app . run ( debug = True ) This piece of code is stored in our main.py. Line 1:  Here we are importing the Flask module and creating a Flask web server from the Flask module. Line 3: __name__ means this current file . In this case, it will be main.py. This current file will represent my web application. We are creating an instance of the Flask class and calling it app. Here we are creating a new web application. Line 5:  It represents the default page. For example, if I go to a website such as “google.com/” with nothing after the slash. Then this will be the default page of Google. This is what the @app.route(“/”) will represe