当我在cmd中键入此命令(用于创建sqlite数据库表)时:from my_python_file 导入数据库。它说:-ModuleNotFoundError:没有名为“ flask.ext”的模块。我已经安装了烧瓶湿化学疗法。请任何人帮助!
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
import flask_whooshalchemy as wa
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = r'sqlite:///D:\\blog\\mydb.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['WHOOSH_BASE'] = 'whoosh'
db = SQLAlchemy(app)
class Post(db.Model):
__searchable__ = []
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100))
content = db.Column(db.Stirng(1000))
wa.whoosh_index(app, Post)
@app.route('/')
def index():
return render_template('home.html', title=title)
if __name__ == '__main__':
app.run(debug=True)