🔒 manage secret and port via environment variables
This commit is contained in:
6
app.py
6
app.py
@@ -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)
|
||||||
Reference in New Issue
Block a user