Sharing postgress DB between 2 services
How do i share the same PostgressSQL Db instance between 2 services in railway.
Solution:Jump to solution
open up the raw editor in both of the services variables tabs, and then paste in this
```env
PGDATABASE=${{Postgres.PGDATABASE}}
PGUSER=${{Postgres.PGUSER}}
PGPASSWORD=${{Postgres.PGPASSWORD}}...
9 Replies
Project ID:
N/A
N/A
is postgres in the same project?
yes
i will show u screenshot
i want mails service and web service to share the same Db instance
i have added all the db user/password/url variables to both web and mails
services
Solution
open up the raw editor in both of the services variables tabs, and then paste in this
then in your code you connect to the database as shown here
https://github.com/railwayapp-templates/django/blob/main/mysite/settings.py#L81-L90
Thank you so much , my issues are resolved! really appreciate your inputs
no problem!