Fix FastAPI + Celery deployment error on Railway
meellc
HOBBYOP

10 months ago

Hey all! I'm deploying a FastAPI + Celery backend on Railway. The app tries to connect to the database using await database.connect() inside my lifespan function, but I'm getting this error:

NameError: name 'database' is not defined

I do have a DATABASE_URL set in my environment variables, and I'm using the databases library with asyncpg.

Any idea what I might be missing, or how I should properly structure this? Thanks!

$10 Bounty

2 Replies

meellc
HOBBYOP

10 months ago

7cf1d20e-b77e-42d1-b4c7-c5ec19f3f8e8


clashing
FREE

10 months ago

How are you defining the database variable in your code, please provide that code snippet


Welcome!

Sign in to your Railway account to join the conversation.

Loading...