AttributeError: 'NoneType' object has no attribute '_instantiate_plugins' (Cannot import create_engine)

后端 未结 3 657
误落风尘
误落风尘 2021-01-26 15:16
import os

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

engine=create_engine(os.getenv(\"DATABASE_URL\"))
db = scoped_se         


        
3条回答
  •  时光取名叫无心
    2021-01-26 15:25

    just use this as url "postgresql://username:password@host:port/database" directly pass these values inside your create_engine("postgresql://username:password@host:port/database")

    I was having the same problem now its gone.That worked for me. Only thing important to mention is that I got a different error altogether after creating the new user and database and moving the tables. The error was '

    '' ModuleNotFoundError: No module named 'psycopg2' '''

    and the solution was running: pip3 install psycopg2-binary

    PS: URL details with you details.

提交回复
热议问题