From bc33f5f755cb6b6663397fc0c72566ae85dce589 Mon Sep 17 00:00:00 2001 From: Vahe Sahakyan Date: Sat, 9 May 2020 18:31:22 +0200 Subject: [PATCH 1/3] Flask: Enable environment variable based host and port settings --- flask/runserver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flask/runserver.py b/flask/runserver.py index e063d5a39..eb6329328 100755 --- a/flask/runserver.py +++ b/flask/runserver.py @@ -1,5 +1,6 @@ from notejam import app +from os import environ if __name__ == '__main__': - app.run() + app.run(host=environ.get("APP_HOST"), port=int(environ.get("APP_PORT", 5000))) From 1eafb3dd29039e51eeb6c5fce922ebdccd82cff4 Mon Sep 17 00:00:00 2001 From: Vahe Sahakyan Date: Sat, 9 May 2020 18:31:57 +0200 Subject: [PATCH 2/3] Flask: use schema-less URLs for external css --- flask/notejam/templates/base.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flask/notejam/templates/base.html b/flask/notejam/templates/base.html index f20662fb9..2a3348da5 100644 --- a/flask/notejam/templates/base.html +++ b/flask/notejam/templates/base.html @@ -20,9 +20,9 @@ - - - + + + From 3ec6ccc8dbca85a066f375e152ea434c3191f090 Mon Sep 17 00:00:00 2001 From: Vahe Sahakyan Date: Sat, 9 May 2020 18:32:15 +0200 Subject: [PATCH 3/3] Flask: convert pad_id=0 to None to avoid DB constraint errors --- flask/notejam/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/notejam/views.py b/flask/notejam/views.py index 88a105d41..77606a2a3 100644 --- a/flask/notejam/views.py +++ b/flask/notejam/views.py @@ -35,7 +35,7 @@ def create_note(): note = Note( name=note_form.name.data, text=note_form.text.data, - pad_id=note_form.pad.data, + pad_id=note_form.pad.data or None, user=current_user ) db.session.add(note)