From 6c5144ae575db974e69ec7a09f8a90035c6b706b Mon Sep 17 00:00:00 2001 From: Daniel Rahamim Date: Sun, 25 Dec 2022 18:56:20 -0800 Subject: [PATCH] fix: move secret key to config file (#7) --- .gitignore | 1 + app.py | 4 ++-- example.config.toml | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 example.config.toml diff --git a/.gitignore b/.gitignore index 7291282..c412538 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,4 @@ database.db .DS_Store +config.toml \ No newline at end of file diff --git a/app.py b/app.py index 689e74e..f28a874 100644 --- a/app.py +++ b/app.py @@ -1,10 +1,10 @@ import sqlite3 from flask import Flask from flask import render_template, request, url_for, flash, redirect, abort - +import toml app = Flask(__name__) -app.config['SECRET_KEY'] = 'secretkey' +app.config.from_file("config.toml", load=toml.load) def get_db_connection(): diff --git a/example.config.toml b/example.config.toml new file mode 100644 index 0000000..b857db5 --- /dev/null +++ b/example.config.toml @@ -0,0 +1,9 @@ +[default] +SECRET_KEY = "SomethingNEAT" + + + + + +[development] +SECRET_KEY = "Pl3453Ch4ng3" \ No newline at end of file