Open CelestialGuru opened 3 years ago
I found a way to do it but don't like it:
import os
from django_secrets import SECRETS
from objproxies import LazyProxy
SECRET_KEY = os.environ.get('SECRET_KEY', LaxyProxy(lambda: SECRETS.get('SECRET_KEY')))
hey guys! any news on this? or maybe a way to improve it to work in local and staging/production? @CelestialGuru @LeeHanYeong
I could give a hand and create a PR :)
I cannot figure out how to write a
settings.py
which could work in both a development environment and a production environment. On an EC2 staging instance the following works:but in a local development environment, I'll get an error:
And it doesn't work if I swap the order; python will evaluate both arguments before calling the function:
The only other way I can think to get this to work is to rewrite the settings entirely to have something like
prod.settings.py
anddev.settings.py
, but that doesn't sound very DRY.Another option might be to extend django_secrets.backends.aws_secrets_manager.AWSSecretsManagerSecrets but I feel like that would be more of a monkeypatch than a solution.