From 70fbf451352870f42a433241849d1891802a052e Mon Sep 17 00:00:00 2001 From: Karim Hamidou Date: Sat, 9 Dec 2017 17:44:24 -0800 Subject: [PATCH] Add a basic template --- requirements.txt | 2 ++ templates/index.html | 19 +++++++++++++++++++ web.py | 16 +++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 templates/index.html diff --git a/requirements.txt b/requirements.txt index 448e5a3..d1c1e9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ flask==0.12.2 gunicorn==19.7.1 python-prctl==1.6.1 +WTForms==2.1 +Flask-WTF==0.14.2 diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..e0108b3 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,19 @@ + + + + +

+

+ {{ form.hidden_tag() }} + {% for error in form.code.errors %} +

{{ error }}

+ {% endfor %} +

+ {{ form.code.label }} {{ form.code() }} +

+

+ +

+
+ + diff --git a/web.py b/web.py index a5325ae..6024df0 100644 --- a/web.py +++ b/web.py @@ -1,12 +1,22 @@ import prctl -from flask import Flask +from flask import Flask, render_template, request + +from flask_wtf import FlaskForm +from wtforms import TextField +from wtforms.validators import DataRequired + app = Flask(__name__) -prctl.set_seccomp(True) + +class EvalForm(FlaskForm): + code = TextField('code', validators=[DataRequired()]) + @app.route("/") def hello(): - return "Hello World!" + form = EvalForm() + return render_template("index.html", form=form) + if __name__ == "__main__": app.run() -- 2.43.0