烧瓶错误sqlalchemy.exc.OperationalError:(psycopg2.OperationalError)致命:角色“ admin”不存在

时间:2018-08-13 15:05:44

标签: flask-sqlalchemy

我无法确定Flask Webapp上的错误。我认为这与数据库有关。我有postgres,因为下面的数据库是:

from flask_sqlalchemy import SQLAlchemy
from werkzeug import generate_password_hash, check_password_hash

db = SQLAlchemy()
# db.init_app(app)

class User(db.Model):
    __tablename__ = 'users'
    uid = db.Column(db.Integer, primary_key=True)
    firstname = db.Column(db.String(100))
    lastname = db.Column(db.String(100))
    email = db.Column(db.String(120), unique=True)
    passwdhash = db.Column(db.String(54))

    def __init__(self, firstname, lastname, email, password):
        self.firstname = firstname.title()
        self.lastname = lastname.title()
        self.email = email.lower()
        self.set_password(password)

    def set_password(self, password):
        self.passwdhash = generate_password_hash(password)

    def check_password_hash(self, password):
        return check_password_hash(self.passwdhash, password)

然后我得到这个错误... sqlalchemy.exc.OperationalError sqlalchemy.exc.OperationalError:(psycopg2.OperationalError)严重:角色“ pipi”不存在  (此错误的背景位于:http://sqlalche.me/e/e3q8

0 个答案:

没有答案