OperationalError at / could not translate host name "postgres.railway.internal" to address: Name or service not known
nuelxlencedjangoHOBBY
9 months ago
I have been trying to fix the above error but to no avail. i have changed my database setting these settings below but no result. i cant seem to find the error but i suppose the error is from railway. i use python 3.12. i dont know if the problem is because that or purely railway's. pls help out if you can.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get('DATABASE_NAME'),
'HOST' :os.environ.get('DATABASE_HOST'),
'PORT':os.environ.get('DATABASE_PORT'),
'USER' :os.environ.get('DATABASE_USER'),
'PASSWORD' :os.environ.get('DATABASE_PASSWORD'),
}
}
DATABASES = {
'default': dj_database_url.config(
default={
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DATABASE_NAME', ''),
'USER': os.getenv('DATABASE_USER', ''),
'PASSWORD': os.getenv('DATABASE_PASSWORD', ''),
'HOST': os.getenv('DATABASE_HOST', ''),
'PORT': os.getenv('DATABASE_PORT', ''),
}
)
}
DATABASES = {
'default': dj_database_url.config(
default=os.getenv(
'DATABASE_URL',
f'postgres://{os.getenv("DATABASE_USER", "")}:{os.getenv("DATABASE_PASSWORD", "")}@{os.getenv("HOST", "")}:{os.getenv("DATABASE_PORT", "5432")}/{os.getenv("DATABASE_NAME", "")}'
)
)
}
1 Replies
Status changed to Closed brody • 9 months ago