Setting environment variables in virtualenv (Python, Windows) Setting environment variables in virtualenv (Python, Windows) flask flask

Setting environment variables in virtualenv (Python, Windows)


Flask does not automatically take configuration variables from environment variables. You have to set them manually like so:

app.config.from_envvar('YOURAPPLICATION_SETTINGS')

More info regarding configuration can be found here.

To set an environment variable in Windows, you should do as described here:

setx DATABASE_URL=sqlite://something.something


The problem was that PyCharm does not activate the virtualenvironment when pressing the run button. It only uses the virtualenv python.exe.