diff --git a/Lesson_5/Task 2/templates/index.html b/Lesson_5/Task 2/templates/index.html new file mode 100644 index 0000000..0bcf8de --- /dev/null +++ b/Lesson_5/Task 2/templates/index.html @@ -0,0 +1,16 @@ + + + + Calculator + + +
+
+
+
+
+ +
+ + + diff --git a/Lesson_5/Task 2/webserver.py b/Lesson_5/Task 2/webserver.py new file mode 100644 index 0000000..6688332 --- /dev/null +++ b/Lesson_5/Task 2/webserver.py @@ -0,0 +1,13 @@ +from flask import Flask, render_template, redirect, request +from datetime import datetime + +app = Flask("Calculator") + +@app.route('/') +def index(): + result = None + if 'operation' in request.args: + result = eval(request.args.get('operation')) + return render_template("index.html", result=result) + +app.run(port=8080)