烧瓶 - postgresql-关系不存在
我正在尝试为烧瓶应用程序创建新数据库(从SQLite迁移到PostgreSQL)。当应用启动并调用函数create_all()
应用程序发送错误关系“用户”不存在“不存在”
为以下事件侦听器:
@event.listen_for(User.__table__, 'after_create')
def create_default_user(*args, **kwargs):
print("Create User Table - Default User")
db.session.add(User(username="admin", email="[email protected]", password=generate_password_hash("admin", "sha256")))
db.session.commit()
如果我创建新的SQLITE DB (“ sqlite://db.sqlite” )都可以正常工作,但是如果我想启动PostgreSQL数据库(“ Postgresql:// /l/电子邮件保护“ class =” __ cf_email__'data-cfemail =“ E08D99939590859290819393978F9284AA0D1D1D7D2CED1D7CED1D7CED1D7CED0CED2”
>错误 ?
I am trying to create new database (migrate from sqlite to postgresql) for my flask App. When the app starts and call the function create_all()
the app send the error relation "user" does not exists"
for the following event listener :
@event.listen_for(User.__table__, 'after_create')
def create_default_user(*args, **kwargs):
print("Create User Table - Default User")
db.session.add(User(username="admin", email="[email protected]", password=generate_password_hash("admin", "sha256")))
db.session.commit()
If I create new sqlite db ("sqlite://db.sqlite") all works fine, But if i want to initiate postgresql database ("postgresql://test:[email protected]:5432/flask") i got the error.
Someone know where i did a mistake ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论