-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escaped Dollar sign ($) in string environment variables not getting cleaned after import #271
Comments
Interestingly enough, I encountered an issue related to this yesterday. My organization uses VSCode, and the variable substitution syntax it uses requires the more explicit variable definition of:
This means that, functionally, I am unable to use variable substitution, since it won't work if ran from the VSCode debugger AND if ran in the shell. If django-environ could support both styles, that would be amazing. And from looking at the code, probably not a difficult change. *Edit: Whoops. Also meant to add that this would solve mmoallemi99's issue. |
Would really love to see this fixed as it's also preventing our organization from moving the SECRET_KEY to env. |
We are having the same issue, Is it fixed yet? |
Correction done? |
Same here switched to python-dotenv in the meantime, but this is not a good replacement as you have to do type conversion by yourself e.g. for int and list values. |
@mmoallemi99 I'm currently using your suggestion, but many still have this problem, any forecast when they will analyze and fix this bug? |
I'l sort out with this ASAP. |
Looking forward to a release, that supports completely disabling proxy/interpolation (or at least using only Thank you for your work on all those recent updates @sergeyklay ! |
I apologize @fdemmer for completely overlooking this issue. Thank you for the reminder. Version v0.8.0 with an ability to escape dollar sign (
For details and usage please refer the documentation: https://django-environ.readthedocs.io/en/latest/tips.html#escape-proxy Today we released a hotfix version v0.8.1:
Thank you all for your patience, and I am sorry about the delay. |
I have upgraded the django-environ library and also using the syntax provided in documentation here - https://django-environ.readthedocs.io/en/latest/tips.html#escape-proxy django-environ==0.8.1 .env file : .py file : But facing the same error:
Looks like the error comes even before we can reach the "escape_proxy" setting. |
Apparently I cannot use quotes ("") to encase the ESCAPED_VAR in env file. @sergeyklay - Should this also be mentioned in the documentation? |
Hi everyone
|
version=0.9.0 Still same issue. # .env
SECRET_KEY=supersecret
# settings.py
SECRET_KEY = env('SECRET_KEY', parse_default=lambda x: f'${x}') |
single quotes worked for me |
This has been confusing me for some while as I couldn't understand why my Just to let you know regarding the documentation, it's a bit misleading, as the issue will arise whenever there's a Edit because I wrote something incorrect. For instance, setting as value |
Hi People,
I've encountered an issue while setting the
EMAIL_HOST_PASSWORD
environment variable.If you have Dollar sign $ in the beginning of your env variable string
django-environ
treats it as another environment variable (nested variable):.env
file:settings.py
This configuration raises:
which as you can see omitted the first $ sign.
Now if we try to escape the $ character with a backslash and change our .env file to this:
django-environ
escapes the backslash instead of the dollar sign $ and we end up with something like this:Which breaks our configurations and settings.
This is my proposal which if is agreed on I'll make a pull request:
The text was updated successfully, but these errors were encountered: