提交 e1ddc706 编写于 作者: M Miguel Angel Garcia

update python-flask-example-heroku materials

上级 39a05371
venv
__pycache__
\ No newline at end of file
......@@ -2,9 +2,11 @@ import os
from flask import Flask
app = Flask(__name__)
app.config.from_object(os.getenv("APP_SETTINGS", "config.DevelopmentConfig"))
env_config = os.getenv("APP_SETTINGS", "config.DevelopmentConfig")
app.config.from_object(env_config)
@app.route("/")
def index():
return f"The configured secret key is {app.config.get('SECRET_KEY')}"
secret_key = app.config.get("SECRET_KEY")
return f"The configured secret key is {secret_key}."
import os
class Config(object):
class Config:
DEBUG = False
TESTING = False
SECRET_KEY = os.getenv("SECRET_KEY", "this-is-read-from-env")
DEVELOPMENT = False
SECRET_KEY = os.getenv("SECRET_KEY", "this-is-the-default-key")
class ProductionConfig(Config):
DEBUG = False
pass
class StagingConfig(Config):
DEVELOPMENT = True
DEBUG = True
class DevelopmentConfig(Config):
DEVELOPMENT = True
DEBUG = True
DEVELOPMENT = True
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册