Environment variables are a way to store configuration data outside of your code. They are used to specify settings, such as API keys or database credentials, that your code requires in order to run properly.
Rather than hardcoding these values directly into your code, you can set them as environment variables on your server. This provides an extra layer of security and flexibility, as you can change the values of these variables without having to modify your code.
In Python, you can access environment variables using the
os module. For example,
os.environ.get('API_KEY') would retrieve the value of an environment variable named "API_KEY".