8 months ago
I created a django project with sql lite db everything works fine when i want to deploy it on vercel I realized i can do it with sqlite so ap trying to migrate to postgesql and make my db live using railway it's my fiest time trying to deploy a project so am so confused . i get the live db created in railway and all the info provided in the variables section to my setting.py configuration of db
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'railway',
'USER':'myuser',
'PASSWORD':'mypswrd',
'HOST':'postgres.railway.internal',
'PORT':'5432'
}
}
here is what i did when but i get this error
psycopg2.OperationalError: could not translate host name "postgres.railway.internal" to address: No such host is known.
which doesn't sense for me since those values are provided by the railway service and still i can't get to make migration right now am testing localing but am doing this to get it deployed I hope i made mysql clear
Anyone did encouter this issue ????
8 Replies
8 months ago
When connecting to the database from outside of the Railway project you will need to use the public host and port.
8 months ago
i already use the MYSQL_PUBLIC_URL from MySQL variable in my railway project but i still get php_network_getaddresses: getaddrinfo for mysql failed: No such host is known.
note: im using laravel and i also already set the .env DB_HOST using the MYSQL_PUBLIC_URL from my railway project
8 months ago
mysql://root:token@junction.proxy.rlwy.net:port/railway
so i need to change my database to this?
MYSQLHOST: mysql://root:token@junction.proxy.rlwy.net:port/railway
MYSQLPORT: port
8 months ago
can you show me which one? :')
Status changed to Solved brody • 8 months ago