File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2626import sys
2727import os
2828import logging
29+ import secrets
2930import importlib .metadata
3031
3132from rich .console import Console
@@ -75,8 +76,6 @@ def create_app(config_override=None, instance_path=None):
7576 #
7677 # Set configuration defaults. If a config file is present then load it. If we have overrides, apply them
7778
78- # TODO
79- #app.config.setdefault('SECRET_KEY', 'JFg4K1l5vVmusHmI0cNAFg')
8079 app .config .setdefault ('SQLALCHEMY_DATABASE_URI' ,
8180 'sqlite+pysqlite:///' + os .path .join (app .instance_path , 'mrmat-python-api-flask.sqlite' ))
8281 app .config .setdefault ('SQLALCHEMY_TRACK_MODIFICATIONS' , False )
@@ -86,6 +85,8 @@ def create_app(config_override=None, instance_path=None):
8685 app .config .from_json (os .path .expanduser (os .environ ['FLASK_CONFIG' ]))
8786 if config_override is not None :
8887 app .config .from_mapping (config_override )
88+ if app .config ['SECRET_KEY' ] is None :
89+ app .config ['SECRET_KEY' ] = secrets .token_urlsafe (16 )
8990
9091 #
9192 # Create the instance folder if it does not exist
You can’t perform that action at this time.
0 commit comments