将postgres与sqlalchemy连接到discord机器人

acruukt9  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(154)

我曾尝试运行一个discord机器人,但我在数据库中运行受阻,我无法解决这个问题

import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker

from inhouse_bot.database_orm import bot_declarative_base 
import sqlalchemy

def migrate():
    # TODO This should be removed in favor of a true database migration tool like Alembic

    # We create the engine to connect to the database
    engine = sqlalchemy.create_engine(os.environ["postgresql+psycopg2://postgres:password@localhost:5432/yohouse-yodismo"])

当我运行bot时,会显示:

"KeyError: 'postgresql+psycopg2://postgres:password@localhost:5432/yohouse-yodismo' "

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题