-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring Initial React and Flask App #25
Conversation
return jsonify({'fragrance': generated_fragrance}) | ||
|
||
if __name__ == '__main__': | ||
app.run(host="0.0.0.0", port=5000, debug=True) |
Check failure
Code scanning / CodeQL
Flask app is run in debug mode High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that the Flask application does not run in debug mode in a production environment. The best way to achieve this is by using an environment variable to control the debug mode. This way, we can set the debug mode to True
during development and False
in production.
- Import the
os
module to access environment variables. - Modify the
app.run
call to set thedebug
parameter based on an environment variable. - Set a default value for the environment variable to ensure the application does not run in debug mode by default.
-
Copy modified lines R26-R28
@@ -25,3 +25,5 @@ | ||
if __name__ == '__main__': | ||
app.run(host="0.0.0.0", port=5000, debug=True) | ||
import os | ||
debug_mode = os.getenv('FLASK_DEBUG', 'False').lower() in ['true', '1', 't'] | ||
app.run(host="0.0.0.0", port=5000, debug=debug_mode) | ||
|
No description provided.