R
Railway12mo ago
lolloden

ImportError on python app deployment

Hello i'm totally new to app deployment via GH. My app keep crashing due to err: "cannot import name 'Annotated' from 'typing' ". By this error i suppose i have to downgrade some python package. I've linked project via cli (python). Could you help solving this error? Thanks
18 Replies
Percy
Percy12mo ago
Project ID: c7394ece-6242-4b88-97ef-f504211fcbd5
lolloden
lollodenOP12mo ago
c7394ece-6242-4b88-97ef-f504211fcbd5
Brody
Brody12mo ago
do you have all your packages in your requirements.txt file?
lolloden
lollodenOP12mo ago
yes alembic==1.12.1 annotated-types==0.6.0 anyio==3.7.1 click==8.1.7 fastapi==0.104.1 greenlet==3.0.1 h11==0.14.0 idna==3.6 Mako==1.3.0 MarkupSafe==2.1.3 psycopg2==2.9.9 pydantic==2.5.2 pydantic_core==2.14.5 sniffio==1.3.0 SQLAlchemy==2.0.23 starlette==0.27.0 typing_extensions==4.8.0 uvicorn==0.24.0.post1
Adam
Adam12mo ago
can you confirm that your code works locally with those specific packages installed?
lolloden
lollodenOP12mo ago
i confirm (python version is 3.11.6)
Adam
Adam12mo ago
mind sharing your repo? I’ll play around with it
lolloden
lollodenOP12mo ago
sorry for bother but actually i changed 1 import and the error is changed in : Is the server running on that host and accepting TCP/IP connections?
Adam
Adam12mo ago
lolloden
lollodenOP12mo ago
sharing repo would be ok.. tell me how to do
Adam
Adam12mo ago
You're attempting to connect to something through localhost, that's why it's failing On Railway, whatever that is should be hosted as a second service and connected through private networking Looks like it's your db that is failing to connect what sort of db is it?
lolloden
lollodenOP12mo ago
postgresql wrong DB url, thanks for pointing that out By that error it seems i can't deal with Db Url . Can you show me how to set a variable? Do i need a .env file? Thanks
Adam
Adam12mo ago
Here are the docs for environment variables https://docs.railway.app/develop/variables
lolloden
lollodenOP12mo ago
do you want repo's url?
Adam
Adam12mo ago
no thank you
lolloden
lollodenOP12mo ago
it seems be working now! thanks!! you guys are amazing! (but stay tuned, i have tons of questions😉 )
Adam
Adam12mo ago
happy to help
Want results from more Discord servers?
Add your server