Browse Source

Use FLASK_DONT_LOAD_ENV flag to disable load .env

pull/2724/head
Hsiaoming Yang 7 years ago committed by David Lord
parent
commit
bac5d6b9f4
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 5
      flask/cli.py

5
flask/cli.py

@ -544,7 +544,10 @@ class FlaskGroup(AppGroup):
# script that is loaded here also attempts to start a server. # script that is loaded here also attempts to start a server.
os.environ['FLASK_RUN_FROM_CLI'] = 'true' os.environ['FLASK_RUN_FROM_CLI'] = 'true'
if self.load_dotenv: val = os.environ.get('FLASK_DONT_LOAD_ENV')
load_dotenv = not val or val in ('0', 'false', 'no')
if self.load_dotenv and load_dotenv:
load_dotenv() load_dotenv()
obj = kwargs.get('obj') obj = kwargs.get('obj')

Loading…
Cancel
Save