Skip to content

Commit e1ddc70

Browse files
committed
update python-flask-example-heroku materials
1 parent 39a0537 commit e1ddc70

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
venv
2+
__pycache__

python-flask-example-heroku/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
from flask import Flask
33

44
app = 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("/")
910
def 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}."
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import 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

1010
class ProductionConfig(Config):
11-
DEBUG = False
11+
pass
1212

1313

1414
class StagingConfig(Config):
15-
DEVELOPMENT = True
1615
DEBUG = True
1716

1817

1918
class DevelopmentConfig(Config):
20-
DEVELOPMENT = True
2119
DEBUG = True
20+
DEVELOPMENT = True

0 commit comments

Comments
 (0)