From c6170186117fa3355d83d92f50c32843ccff5b52 Mon Sep 17 00:00:00 2001 From: siulkilulki Date: Fri, 4 May 2018 23:25:07 +0200 Subject: [PATCH] Restructure code. Add frontend template. (logic to be done) --- annotator/app.py | 9 ------ webapp/app.py | 24 ++++++++++++++++ webapp/templates/index.html | 55 ++++++++++++++++++++++++++++++++++++ annotator/wsgi.py => wsgi.py | 2 +- 4 files changed, 80 insertions(+), 10 deletions(-) delete mode 100644 annotator/app.py create mode 100644 webapp/app.py create mode 100644 webapp/templates/index.html rename annotator/wsgi.py => wsgi.py (60%) diff --git a/annotator/app.py b/annotator/app.py deleted file mode 100644 index 34b1c5c..0000000 --- a/annotator/app.py +++ /dev/null @@ -1,9 +0,0 @@ -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "

Hello There!

" - -if __name__ == "__main__": - app.run(host='0.0.0.0') diff --git a/webapp/app.py b/webapp/app.py new file mode 100644 index 0000000..221bdcd --- /dev/null +++ b/webapp/app.py @@ -0,0 +1,24 @@ +from flask import Flask, render_template, request +app = Flask(__name__) + +def post_action(): + return get_action() + +def get_action(): + hour = '12.00' + left_context = 'Dawno, dawno temu był sobia para młoda, bardzo piękna para młoda. Msza rozpocznie się o godzinie ' + right_context = '. Następnie para młoda uda się na wesele do Kubusia i będą się bawić do białego rana.' + return render_template('index.html', hour=hour, left_context=left_context, right_context=right_context) + +@app.route("/", methods=['GET', 'POST']) +def root(): + if request.method == 'POST': + return post_action() + else: + return get_action() + + + + +if __name__ == "__main__": + app.run(host='0.0.0.0', debug=True) diff --git a/webapp/templates/index.html b/webapp/templates/index.html new file mode 100644 index 0000000..d42b77d --- /dev/null +++ b/webapp/templates/index.html @@ -0,0 +1,55 @@ + + + + + + + + + + + Annotator mszy świętych + + +
+
+
+ +
+
+

Czy zaznaczono godzinę mszy świętej?

+
+
+
+

{{ left_context }}{{ hour }}{{right_context}}

+
+
+
+
+ + +
+
+ + + + + + + + diff --git a/annotator/wsgi.py b/wsgi.py similarity index 60% rename from annotator/wsgi.py rename to wsgi.py index 6026b0f..a579ade 100644 --- a/annotator/wsgi.py +++ b/wsgi.py @@ -1,4 +1,4 @@ -from app import app +from webapp.app import app if __name__ == "__main__": app.run()