Тёмный

Load Environment Variables From .env Files in Python 

NeuralNine
Подписаться 358 тыс.
Просмотров 65 тыс.
50% 1

Today we go a little bit deeper into the Python dotenv module, which allows us to load environment variables from .env files.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine.com/books/
💻 The Algorithm Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/

Наука

Опубликовано:

 

1 май 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@kenkioqqo
@kenkioqqo Год назад
I'm on your third video, and it's absolutely mind-boggling how you happen to be teaching the exact Python concepts I want to learn quickly for my current project. You're just the helper I was looking for.
@beastlorion5245
@beastlorion5245 6 месяцев назад
Awesome tutorial. Thanks for making this quick and painless
@Dev_Gisoun
@Dev_Gisoun 2 месяца назад
Your lecture was very easy to follow and effective! It was really helpful for me.
@kylecurry6841
@kylecurry6841 Год назад
Ironically, I just began using python-decouple for .env files which happens to be one of a few late improvements in my scripting. Love this channel, definitely a gold mine of dev related knowledge.
@Stopinvadingmyhardware
@Stopinvadingmyhardware Год назад
How does that function?
@maxwhittaker1175
@maxwhittaker1175 Год назад
Learn't so much from this channel ❤
@debashreewaddadar1468
@debashreewaddadar1468 8 месяцев назад
Thank you soo much, it saved me hours of debugging!!! 💟
@appaloosa-marketing
@appaloosa-marketing Год назад
Hello, I am confused by your use of $ and non-string values within your dotenv file. What is the purpose of this? Sorry if this is a dumb question & thanks for your video
@krishj8011
@krishj8011 Месяц назад
Thanks... Great Tutorial
@tanuj05
@tanuj05 4 месяца назад
Nice and informative video
@wg2
@wg2 Год назад
Hey, thanks a bunch! So, the other day I accidentally made my OpenAI API key public for a short while, and had to delete the whole repository. But thanks to your help, I'm following best practices now. By the way, I can't help but notice your white board - looks like there are some differential equations and a neural network model, maybe some content related to gradient descent too? It's really intriguing!
@Lab1401
@Lab1401 Год назад
Best channel ever for python ❤❤🎉🎉🎉
@manifestasisanubari
@manifestasisanubari 5 месяцев назад
Is it recommended to store list and integer in .env? Because I need to convert `os.getenv()` with `ast.literal_eval` before passing as a variable. I store related RSS URL as a list in my script.
@olorundaremicheal8015
@olorundaremicheal8015 Год назад
Thanks for this tutorials, actually have been struggling to get a way around this .env thing for a while with a kivy app. Please I mean to ask, is this a very secure way to do it or there are other ways plus when I try to use it with my kivy app, bulldozer keeps giving me errors whenever it tries to download the dotenv module. Thanks in anticipation boss
@sbj6173
@sbj6173 Год назад
Thanks for sharing 👍
@murphygreen8484
@murphygreen8484 18 дней назад
What is the benefit of doing this over a regular toml or yaml or ini file?
@Roman-kn7kt
@Roman-kn7kt 2 месяца назад
Oh, that look “If you don’t understand through my video what I explained to you, I’ll punch you”😅😅😅 Thank you so much for your content, sir, you are the best!
@krzysiekkrzysiek9059
@krzysiekkrzysiek9059 Год назад
Awesome tutorial 👍Need more Flask and Django.
@birdie123
@birdie123 Год назад
What are the pros and cons of using .ini, .env, .toml and .yaml for storing environment variables?
@moviesnight248
@moviesnight248 9 месяцев назад
The choice of a configuration format for storing environment variables (or other configuration settings) depends on various factors, including ease of use, readability, and the specific needs of your application. .ini: Pros: Simple and Human-Readable: .ini files are straightforward to read and write. They use a plain text format with a simple key-value structure. Widely Supported: .ini files are supported by a wide range of programming languages and libraries, making them versatile for configuration. Cons: Limited Structure: .ini files lack complex data types, which can be a limitation for more advanced configuration needs. No Nested Structures: .ini files do not support nested structures, making it harder to organize complex configurations. .env (Environment Variables): Pros: Security: .env files are a secure way to store sensitive environment variables since they are typically not committed to version control. Platform-Agnostic: .env files are compatible with most platforms and languages, and they can be used in different development and deployment environments. Cons: Limited to Key-Value Pairs: .env files are limited to key-value pairs and don't support complex data structures. No Comments or Metadata: .env files lack the ability to add comments or metadata, making it harder to provide context for each variable. .toml: Pros: Rich Data Types: TOML supports a wide range of data types, including arrays, tables, and nested structures. Human-Readable: TOML is designed to be easy to read and write for humans. Comments: TOML allows comments, which can provide valuable context for each variable. Cons: Complexity: The richer data types in TOML can add complexity to the configuration, which may not be necessary for simple settings. .yaml (YAML): Pros: Highly Readable: YAML is known for its high readability and is often used for configuration files. Rich Data Types: YAML supports complex data structures, including lists and dictionaries, making it suitable for more complex configurations. Comments: Some YAML implementations support comments, providing context for variables. Cons: Indentation Sensitive: YAML relies on indentation for structure, which can be a source of issues when formatting is inconsistent. Potential Security Risks: Be cautious when using YAML for sensitive data, as it's not designed for security like .env files. In summary, the choice of format depends on your specific requirements. If you need a simple, human-readable format, .ini or .env might be suitable. If you need richer data types and nesting, TOML and YAML are better choices. Additionally, consider security, compatibility with your development stack, and whether comments and metadata are important for providing context in your configuration files.
@hamzazahidulislam3490
@hamzazahidulislam3490 4 месяца назад
Thanks
@user-lo3xm2ff9w
@user-lo3xm2ff9w 6 месяцев назад
cool man thanks
@didierdavid9324
@didierdavid9324 Год назад
Thanks for this tutorial Which plugin do you use in Pycharm to detect .env and .secret files
@explorewithskp1237
@explorewithskp1237 Год назад
I also did the same as in video but getting error like " Unresolved reference 'dotenv' "
@explorewithskp1237
@explorewithskp1237 Год назад
I did the same as like in video but getting this erro "Unresolved reference 'dotenv'". Could someone help me
@WaterWheel990
@WaterWheel990 Месяц назад
How would I handle Environmental Variables with Inno Setup?
@itstobystic
@itstobystic Год назад
what happens when you have more than one .env file ?
@user-td4pf6rr2t
@user-td4pf6rr2t 12 дней назад
can i load my zshrc or netrc/wgetrc
@dkjb5756
@dkjb5756 10 месяцев назад
What is this black colour tool Python which version?
@michaeljosiah536
@michaeljosiah536 8 месяцев назад
Does anybody know how to make this work when you make your Python file into a .exe Python file?
@eugeneL_N1E104
@eugeneL_N1E104 Год назад
maybe can add to your python tip&tricks playlist or add a series of python 3rd party useful toolkits list XD
@The-Martian73
@The-Martian73 Год назад
What is going on guys welcome back to ... we are going to develop brains !!❤
@sayalikhairnar3166
@sayalikhairnar3166 6 месяцев назад
I am not able to install dotenv. It is showing - could not be able to find the right version. Anybody know it's solution??
@mbegaliful
@mbegaliful 5 месяцев назад
I had a similar issue because I was trying to install: dotenv instead of python-dotenv
@daviesemmanuel8047
@daviesemmanuel8047 8 месяцев назад
I did the exact same thing but I keep getting (None)
@daviesemmanuel8047
@daviesemmanuel8047 8 месяцев назад
Nevermind I forgot to save the .env file
@bfkmnemonic
@bfkmnemonic Год назад
I struggle to see the benefit of using environment variables loaded from a file compared to loading setting directly from a file (json, ini) into program variables. It seems unnecessary and inefficient to have to bother the operating system every time you need a value.
@StNicolay
@StNicolay Год назад
So do I, but I have to say that they are incredibly useful if your application can be run in a docker container because it's the easiest way to provide configuration in that situation
@leftblank5315
@leftblank5315 Год назад
It's industry standard, especially when deploying workloads in containers/serverless
@TheDavidlloydjones
@TheDavidlloydjones Год назад
"Let us get right into it," you say. I think you already did. This "so let's get started" thingie is all over RU-vid -- always spoken by people who have already started. One thank-you, though: thank you for skipping the "without further ado."
@FIGP1
@FIGP1 Год назад
Yes, just like hello, hi, etc. are used by a lot of people. Does that mean that we should stop using those?
@maliquewilliams983
@maliquewilliams983 2 месяца назад
Subscribe. I feel like this is illegal to learn for free.
Далее
Советы на всё лето 4 @postworkllc
00:23
Debugging 101: Replace print() with icecream ic()
12:36
The Complete Guide to Python Virtual Environments!
15:52
How to use environment variables in a Python script
9:22
15 Python Libraries You Should Know About
14:54
Просмотров 378 тыс.
Linux for Programmers #7 | Environment Variables
12:31
5 Good Python Habits
17:35
Просмотров 468 тыс.
Working with YAML Files in Python
16:47
Просмотров 44 тыс.