Dictster

app Object (Flask)

Definition

The Flask Application Object is an instance of the Flask() class in the Flask web framework. It serves as the core structure that holds the configuration, routes, request handlers, and various components necessary to manage a Flask web application.


Description

The Flask Application Object acts as the central interface for a Flask project. It is responsible for:

The object is typically initialized using the following syntax:

from flask import Flask
app = Flask(__name__)

Attributes


Methods


Example

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "Hello, World!"

if __name__ == '__main__':
    app.run()

In this example, the app variable is the Flask Application Object that controls the routing and execution of the web application.


Related Objects

Flask Web Framework Flask Application Object