flask whooshalchemy错误:ModuleNotFoundError:没有名为“ flask.ext”的模块

时间:2018-10-30 14:05:21

标签: python flask

当我在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)

0 个答案:

没有答案