File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2222def create_app ():
2323 """Create and configure the Flask application."""
2424 app = Flask (__name__ )
25- app .secret_key = os .getenv ("FLASK_SECRET_KEY" , "supersekrit" )
25+ app .secret_key = os .getenv ("FLASK_SECRET_KEY" )
26+ if not app .secret_key :
27+ import secrets
28+ app .secret_key = secrets .token_hex (32 )
29+ logging .warning ("FLASK_SECRET_KEY not set, using generated key. Set this in production!" )
2630
2731 # Google OAuth setup
2832 GOOGLE_CLIENT_ID = os .getenv ("GOOGLE_CLIENT_ID" )
Original file line number Diff line number Diff line change 55app = create_app ()
66
77if __name__ == "__main__" :
8- app .run (debug = True )
8+ import os
9+ debug_mode = os .environ .get ('FLASK_DEBUG' , 'False' ).lower () == 'true'
10+ app .run (debug = debug_mode )
11+ # This allows running the app with `flask run` or directly with `python api/index.py`
12+ # Ensure the environment variable FLASK_DEBUG is set to 'True' for debug mode
13+ # or 'False' for production mode.
You can’t perform that action at this time.
0 commit comments