Skip to content
django.db.utils.OperationalError: [Errno 11001] getaddrinfo failed Django project connecting todb
denistsh01
OP

2 years ago

django.db.utils.OperationalError: [Errno 11001 unable to connect to db

Solved

42 Replies

denistsh01
OP

2 years ago

ac9964b2-c042-43a4-8a28-e83db3a4a6ee


2 years ago

where do you get this error?


denistsh01
OP

2 years ago

my terminal when i want to open the project


2 years ago

use railway ssh


denistsh01
OP

2 years ago

i cant run the migrations locally


2 years ago

please use railway ssh


denistsh01
OP

2 years ago

railway login

Open the browser? Yes

Logged in as Tsh ([email protected])

PS C:\Users\toshd\Licenta - Copy (4)Chinezu\licentaRepo\backend> railway ssh

Expected welcome message, received: error

PS C:\Users\toshd\Licenta - Copy (4)Chinezu\licentaRepo\backend>


2 years ago

are you linked to the correct service?


denistsh01
OP

2 years ago

i will relink then . i must link it to the BE right ?


denistsh01
OP

2 years ago

not the DB


2 years ago

correct


denistsh01
OP

2 years ago

Expected welcome message, received: error

re linked it again


2 years ago

then run the command locally using the database public host and port


denistsh01
OP

2 years ago

can you give me the template for that ?


2 years ago

there is no template involved


denistsh01
OP

2 years ago

DATABASES = {

'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))

} you mean like this ?


2 years ago

Yep, then use the public URL locally


denistsh01
OP

2 years ago

deploy failed


denistsh01
OP

2 years ago

pre-deploy comand failed


denistsh01
OP

2 years ago

i changed the way i connect to db now what ?


denistsh01
OP

2 years ago

i run makemigrations & migrate with railway run or the usual way ?


denistsh01
OP

2 years ago

ok locally works , but deployment failed


2 years ago

please do not change anything on railway


denistsh01
OP

2 years ago

i just tested with an entrance from local project . but didnt change anything in setup


denistsh01
OP

2 years ago

so ?


2 years ago

please revert the changes you made in railway


denistsh01
OP

2 years ago

what changes


denistsh01
OP

2 years ago

the entrances in db ?


denistsh01
OP

2 years ago

i did not change anything in setup


denistsh01
OP

2 years ago

What changes


2 years ago

you said your service on railway has crashed? what changes did you do to cause that?


denistsh01
OP

2 years ago

it crashed after i changed to DATABASES = {

'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))

}


denistsh01
OP

2 years ago


2 years ago

gotcha, you had the database url set to some render url


2 years ago

i've changed that for you


denistsh01
OP

2 years ago

in service variabls ?


2 years ago

yeah


2 years ago

all good, your service is back online


denistsh01
OP

2 years ago

so now i just keep my commands i dont need to pull variables like the cli version right ?


2 years ago

you need to use the public database url locally


denistsh01
OP

2 years ago

yeah it works locally


2 years ago

!s


Status changed to Solved brody • over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...