Is there a reason why I would use the following:
from flask import Flaskimport stripeclass Config(): STRIPE_SECRET_KEY = 'stripe-secret-key'app = Flask(__name__)app.config.from_object(Config)stripe.api_key = app.config['STRIPE_SECRET_KEY']
rather than populating the .env
file with export STRIPE_SECRET_KEY="stripe-secret-key"
and then using:
from environs import Envfrom flask import Flaskimport stripeenv = Env()env.read_env()stripe.api_key = env.str('STRIPE_SECRET_KEY')
i.e. why wouldn't I just store all environment variables in the Config
class, rather than a .env
file? Is it more secure to use a .env
file?
Thanks for any help here :-)