python-gino/gino

'Config' object has no attribute 'DB_DSN'

ScrimForever opened this issue · 2 comments

  • GINO version: 1.0.1
  • Python version: 3.8
  • asyncpg version:
  • aiocontextvars version:
  • PostgreSQL version: 12

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'

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.

I can resolve informing correctly .env path