Python environment variables - Load variables from an env variables file (.env)

preview_player
Показать описание
In this video tutorial we will learn how to use an env variables file (.env) in Python with the help of a package called python-dotenv. python-dotenv is a package that helps you load secret variables from a file into your application without contaminating your git history with sensitive information. We will load our environment variables from a secrets file and also talk about some best practices when working with .env files.

Chapters:
0:00 Intro
0:56 Initialise poetry project
1:10 Install python-dotenv
1:40 Activate virtual environment
1:46 Install dependencies
2:01 Load .env
5:07 Read variables from .env
9:00 Variable interpolation
11:44 Remember to add .env to .gitignore

Code:

Personal website:
Рекомендации по теме
Комментарии
Автор

Wow, this env variable tips are pure gold!

Sandeep-zuwe
Автор

how to deploy without .env? Please answer me

luxsurj