Can't reach environment variables
felipearcaro
TRIALOP

2 years 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

2 years ago

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


felipearcaro
TRIALOP

2 years 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


2 years ago

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


Status changed to Solved Railway almost 2 years ago


felipearcaro
TRIALOP

2 years ago

That was probably it. Thank you!


Loading...