Комментарии:
in linux after you save your enviroment variables you have to type source .bashrc before restarting your text editor :)
Ответитьhow is having plain text passwords in environment variables secure?
Ответитьsome reason i just get print of none
ОтветитьAnd what about the .env file?
ОтветитьInstead of using os.environ.get(), you can now just use os.getenv()
ОтветитьThank you for your help!!
ОтветитьThis video is outdated for latest version of mac
ОтветитьWhy does this print?
None
None
million 🔥
Congratulations
Easy & fantastic tutorial ! I will definitely use this method to hide my credentials on python boto3 script lol
ОтветитьAmazing
ОтветитьIs there a way to parse this to Powershell?
ОтветитьI've been searching for a solution like this for several days... this solved so many of my headaches.
ОтветитьI used a pip3 package o do this, but now I think this is simpler and easier..
Ответитьuse this cmd `source .bash_profile` after saving the `.bash_profile` file
ОтветитьI keep getting a smtplib.SMTPSenderRefused on video 0 of flask series
How do I check that my environmental variables are correct?
LOVE IT, nobody has explained better! thanks a lot!
ОтветитьCorey MS ❤️❤️❤️❤️ your python videos are pure gold 🥰🥰🥰🥰🥰
Ответитьthx
ОтветитьHi Corey! Great video. If I input print(EMAIL_ADDRESS, should I get 'None' as my output?
ОтветитьHow do you make this work using a virtual environment?
ОтветитьThank You
ОтветитьSir Corey comeback man!!
Ответитьnice ;) thx
ОтветитьI'm running Ubuntu 20.04 and the test script returned 'None' for me until I added the environment variables to ~/.bashrc instead of .bash_profile. So, it seems that the proper procedure may vary with each distribution of Linux.
Ответитьvery helpful, thanks a lot
ОтветитьTalented Teacher. Thanks for your pains. I want to one day build a python package for physics. Your lectures are great help.
ОтветитьThanks for this quick and concise explanation. Is this any more secure than hard-coding the password however? Couldn't someone cat your .bash_profile to see the password, or perform some other trickery to access it?
ОтветитьPretty helpful. But when print the variables, i get a None type back.
Ответитьyou saved my life again!
ОтветитьI think I should worship you for the rest of my life. You are always the savior.
Ответитьthank you for making sense of this for me - was struggling to understand it in text form only! :)
ОтветитьIn my experience, environment variables also serve one important purpose other than maintaining secrecy. By using of environment variables instead of hard coded values I could easily roll out my project without worrying about the API keys and other settings used in the development version updated before uploading source code to the deployment server.🔥
ОтветитьYour explanations are great.
Ответитьno idea what just happened.
Ответить@ Corey Schafer
Thanks for sharing.But it didn't work on AWS linux2 after modify .bash_profile.
How can I do ? Thnak you!!
Great information as always, but I was wondering if I could use a separate text file for holding my credentials and then load it into my python module, I can add that text file in my .gitignore so it will not be pushed. I mean it won't be nice if I generate too many environment variables, it would be confusing if I am working on multiple projects.
ОтветитьHey I'm getting an error when I request a password reset that says 'get_reset_token() missing 1 required positional argument: 'self''. Any idea what could be causing this? I've coped your code from your github so I'm confident I have exactly what you have!
ОтветитьStill very useful 3 years later. Great videos. Btw, how do you manage credentials on scripts that will be hosted online for instance?
ОтветитьHi , Nice tutorial, just a quick question, will this work the same if the code is pushed to a remote server?
ОтветитьHow can i be able to access this value in some other machine if I want to??
Ответитьdepending on the shell you are using, look for corresponding .xxrc file. (e.g. if you use zsh, .zshrc; if bash, then .bashrc)
Ответитьplz show me how to use this in the virtual env (venv) for windows
ОтветитьHow about creating a separate file for security data, then adding that file to gitignore, and reading the necessary data from that file when needed?
ОтветитьI get None
ОтветитьIf you are using Linux Box , the solution is to put your environment variables in "/etc/environment".
Example in your /etc/environment file:
------------------------------------------------------------------------------------
DB_USER="Y=User name"
DB_PASS="Your Password"
-------------------------------------------------------------------------------------
And reboot your computer. you will have access to them in your python files using:
import os
DB_USER=os.environ["DB_USER"]
can you save the py file anywhere on the computer ??? does it matter??
ОтветитьIt didnt work for me i kept getting none
Ответить