python-gino / gino

GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
https://python-gino.org/
Other
2.67k stars 150 forks source link

'Config' object has no attribute 'DB_DSN' #738

Closed ScrimForever closed 3 years ago

ScrimForever commented 3 years ago

Description

When i use documentation of Gino Webserver Fastapi, i try reproduce db = Gino(....) , so all parameters on .env file pass, so AttributeError: 'Config' object has no attribute 'DB_DSN'

my DB_DSN is DB_DSN=postgres+psycopg2://postgres@localhost:5432/fund_api , no have password

i tried with many variables options like: 'postgresql+psycopg2://postgres@localhost:5432/fund_api' "postgresql+psycopg2://postgres@localhost:5432/fund_api" "postgresql://postgres:@localhost:5432/fund_api" "postgresql://postgres:@localhost:5432/fund_api"

What I Did

 File "./main.py", line 2, in <module>
    from src.models import db
  File "/home/scrimfx/Projetos/FundAPI/fundenor-api/src/models/__init__.py", line 6, in <module>
    dsn=config.DB_DSN,
AttributeError: 'Config' object has no attribute 'DB_DSN'
wwwjfy commented 3 years ago

From the error, it's not about the value of DB_DSN, but class Config doesn't have DB_DSN. I guess it's defined somewhere else.

ScrimForever commented 3 years ago

I can resolve informing correctly .env path