Computer scienceBackendFlaskApplication Architecture

Structuring the application

Your package has arrived

Report a typo

After reading this guide, even though he is just getting started with flask , James decided to convert his flask code file into a package. He originally had a file called app.py :

from flask import Flask,render_template

app = Flask(__name__)

@app.route("/")
def index():
  return render_template("index.html")

#...

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

now his structure is :

and his app.py has changed to route.py:

#route.py
from sample import app
@app.route("/")
def index():
  return render_template("index.html")

Write down the code that must be inside __init__.py in order for this flask package to be functional.

Write a program in Python 3
#__init__.py
___

Create a free account to access the full topic