mirror of
https://github.com/shouptech/flask-tutorial.git
synced 2026-02-03 15:39:44 +00:00
Get SECRET_KEY from environment
This commit is contained in:
parent
fc55d01d03
commit
e7e24e489f
2 changed files with 4 additions and 1 deletions
|
|
@ -4,6 +4,9 @@ jobs:
|
||||||
docker:
|
docker:
|
||||||
- image: python:3
|
- image: python:3
|
||||||
|
|
||||||
|
environment:
|
||||||
|
SECRET_KEY: DEV
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: pip install pytest coverage
|
- run: pip install pytest coverage
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ def create_app(test_config=None):
|
||||||
# create and configure the app
|
# create and configure the app
|
||||||
app = Flask(__name__, instance_relative_config=True)
|
app = Flask(__name__, instance_relative_config=True)
|
||||||
app.config.from_mapping(
|
app.config.from_mapping(
|
||||||
SECRET_KEY='dev',
|
|
||||||
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
|
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
|
||||||
|
SECRET_KEY = os.environ.get("SECRET_KEY", default=None)
|
||||||
)
|
)
|
||||||
|
|
||||||
if test_config is None:
|
if test_config is None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue