Replies: 1 comment 4 replies
-
Actually it seems the environment variables are NOT getting recognized from the .env file. Are they processed out of order? ```{python}
#| echo: false
from dotenv import load_dotenv
import os
load_dotenv()
VIDEO_URL = os.getenv("EXERCISE_1_VIDEO_URL", default="https://vimeo.com/1078779616")
```
{{< video "`{python} VIDEO_URL`"
title= "Hello, Version Control Exercise Walkthrough" >}}
{{< video `{python} VIDEO_URL`
title= "Hello, Version Control Exercise Walkthrough" >}}
{{< video "{{< env EXERCISE_1_VIDEO_URL >}}"
title="Hello, Version Control Exercise Walkthrough" >}}
{{< video "https://vimeo.com/1078779616"
title= "Hello, Version Control Exercise Walkthrough" >}}
In this example, the fourth works because the URL is hard-coded. The second works, but only because of the default value set in the os.getenv statement (and when it is customized in the .env file it is not recognized.). The first and third do not work. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
How to recognize environment variables set in the .env file?
I read the documentation pages about environment variables but noticed the setup was not working.
I have
python-dotenv
installed already. Here is what I tried:The environment variable reference described by the docs doesn't work. The inline python variable reference does work.
Beta Was this translation helpful? Give feedback.
All reactions