File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
python-flask-example-heroku Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11venv
2+ __pycache__
Original file line number Diff line number Diff line change 22from flask import Flask
33
44app = Flask (__name__ )
5- app .config .from_object (os .getenv ("APP_SETTINGS" , "config.DevelopmentConfig" ))
5+ env_config = os .getenv ("APP_SETTINGS" , "config.DevelopmentConfig" )
6+ app .config .from_object (env_config )
67
78
89@app .route ("/" )
910def index ():
10- return f"The configured secret key is { app .config .get ('SECRET_KEY' )} "
11+ secret_key = app .config .get ("SECRET_KEY" )
12+ return f"The configured secret key is { secret_key } ."
Original file line number Diff line number Diff line change 11import os
22
33
4- class Config ( object ) :
4+ class Config :
55 DEBUG = False
6- TESTING = False
7- SECRET_KEY = os .getenv ("SECRET_KEY" , "this-is-read-from-env " )
6+ DEVELOPMENT = False
7+ SECRET_KEY = os .getenv ("SECRET_KEY" , "this-is-the-default-key " )
88
99
1010class ProductionConfig (Config ):
11- DEBUG = False
11+ pass
1212
1313
1414class StagingConfig (Config ):
15- DEVELOPMENT = True
1615 DEBUG = True
1716
1817
1918class DevelopmentConfig (Config ):
20- DEVELOPMENT = True
2119 DEBUG = True
20+ DEVELOPMENT = True
You can’t perform that action at this time.
0 commit comments