Can't reach environment variables

felipearcaro
TRIAL

a year ago

I am trying to deploy a django application and I've gone through the steps of trying to reach an environment variable.

  • On my settings.py file I have:
    from decouple import config
    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': config('POSTGRESNAME'), 'USER': config('POSTGRESUSER'),
    'PASSWORD': config('POSTGRESPASSWORD'), 'HOST': config('POSTGRESHOST'),
    'PORT': config('POSTGRES_PORT', cast=int),
    },
    }

Added those variables to my project and it's not able to pick it up

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

Solved

4 Replies

a year ago

Where does this magical config() function pull these variables from?


felipearcaro
TRIAL

a year ago

Locally, it was pulling from .env. I left my computer for a few minutes and when I got back, the config() was magically reaching Railway env variables (like it's shown in the logs). Not sure if it takes some time for these variables to propagate once they're added.

Attachments


a year ago

Maybe you forgot to deploy changes, that's a commonly overlooked issue.


Status changed to Solved railway[bot] about 1 year ago


felipearcaro
TRIAL

a year ago

That was probably it. Thank you!


Can't reach environment variables - Railway Help Station