-2

code

from flask import Flask, render_template, session, request

from flask_session import Session


app = Flask(__name__)

app.config["SESSION_PERMANENT"] = False

app.config["SESSION_TYPE"]= "filesystem"

Session(app)

@app.route("/", methods=["GET", "POST"])
def index():
    if session.get("comments") is None:
        session["comments"] = []

if request.method == "POST":
    comment = request.form.get("comment")
    session["comments"].append(comment)

CMD

(env) E:\COURSES\CS50W\lec2\exersice>set FLASK_APP=application.py

(env) E:\COURSES\CS50W\lec2\exersice>python -m flask run

E:\COURSES\CS50W\lec2\exersice\env\Scripts\python.exe: No module named flask

1 Answers1

0

Check this out. If you are not sure whether you have installed flask or not, try running only flask in the cmd or any terminal.If you get any commands about flask then you can be sure that it is installed or you can install by using

pip install flask

If you are concerned about the versions of the libraries you use for your application, then follow the above mentioned link!