我正在使用导入烧瓶会话并在环境模式下使用烧瓶运行时出现以下错误:
错误:在导入“应用程序”时,引发了 ImportError:
Traceback(最近一次调用最后一次):文件“c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask\cli.py”,第 240 行,在 locate_app 导入(module_name) 文件“C:\Users\Adnan\Desktop\Technology\CS50 Web Programming\src2\Flask_Practice\notes\application.py”,第 7 行,在 Session(app) 文件“c:\users\adnan\desktop\技术\cs50 web 编程\src2\routes0\env\lib\site-packages\flask_session__init__.py",第 54 行,在init self.init_app(app) 文件“c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session__init__.py”,第 61 行,在 init_app app.session_interface = self ._get_interface(app) 文件“c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session__init__.py”,第 90 行,在 _get_interface session_interface = FileSystemSessionInterface(File" c:\users\adnan\desktop\technology\cs50 web programming\src2\routes0\env\lib\site-packages\flask_session\sessions.py",第 313 行,init from werkzeug.contrib.cache import FileSystemCache ModuleNotFoundError: No名为“werkzeug.contrib”的模块
这是我在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)