我正在使用从flask_sqlalchemy导入SQLAlchemy。该代码在我的控制台中显示错误 从flask_sqlalchemy导入SQLAlchemy ModuleNotFoundError:没有名为“ flask_sqlalchemy”的模块,而我已经通过
安装了flask-sqlalchemypip安装flask-sqlalchemy。所有代码都在这里
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:@localhost/clean-blog'
db = SQLAlchemy(app)
class Contacts(db.Model):
srno = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
email = db.Column(db.String(50), nullable=False)
phone = db.Column(db.String(20), nullable=False)
message = db.Column(db.String(500), nullable=False)