🔒 manage secret and port via environment variables

This commit is contained in:
mi
2025-11-06 22:13:35 +10:00
parent 651e7c1eab
commit 9c4fb77e5f

6
app.py
View File

@@ -1,10 +1,11 @@
import os
from flask import Flask, render_template, abort from flask import Flask, render_template, abort
from comics_data import COMICS from comics_data import COMICS
app = Flask(__name__) app = Flask(__name__)
# Configuration # Configuration
app.config['SECRET_KEY'] = 'your-secret-key-here' # Change this in production app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'your-secret-key')
def get_comic_by_number(number): def get_comic_by_number(number):
@@ -65,4 +66,5 @@ def page_not_found(e):
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True, port=3000) port = int(os.environ.get('PORT', 3000))
app.run(debug=True, port=port)