I am using importing flask sessions and on using flask run in environment mode I'am having the following error:
Error: While importing "application", an ImportError was raised:
Traceback (most recent call last): File "c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask\cli.py", line 240, in locate_app import(module_name) File "C:\Users\Adnan\Desktop\Technology\CS50 Web Programming\src2\Flask_Practice\notes\application.py", line 7, in Session(app) File "c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session__init__.py", line 54, in init self.init_app(app) File "c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session__init__.py", line 61, in init_app app.session_interface = self._get_interface(app) File "c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session__init__.py", line 90, in _get_interface session_interface = FileSystemSessionInterface( File "c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session\sessions.py", line 313, in init from werkzeug.contrib.cache import FileSystemCache ModuleNotFoundError: No module named 'werkzeug.contrib'
Here is my main code in python:
from flask import Flask, render_template, request, session
from flask_session import Session
app = Flask(__name__)
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)
notes = []
@app.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
note = request.form.get("note")
notes.append(note)
return render_template("index.html", notes=notes)
pip intall werkzeug
. – Ejazwerkzeug
module. – Ejaz