From: Karim Hamidou Date: Sun, 10 Dec 2017 01:44:24 +0000 (-0800) Subject: Add a basic template X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=70fbf451352870f42a433241849d1891802a052e;p=minival.git Add a basic template --- 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()