]> khamidou — GitHub mirrors - minival.git/commitdiff
Add a basic template
authorKarim Hamidou <khamidou@gmail.com>
Sun, 10 Dec 2017 01:44:24 +0000 (17:44 -0800)
committerKarim Hamidou <khamidou@gmail.com>
Sun, 10 Dec 2017 01:44:24 +0000 (17:44 -0800)
requirements.txt
templates/index.html [new file with mode: 0644]
web.py

index 448e5a3ba615b8afc577e61e8922919588661fdb..d1c1e9f2f38647d68ad9b963e0887f0b3b0f46ab 100644 (file)
@@ -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 (file)
index 0000000..e0108b3
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+
+<html>
+  <body>
+    <p>
+    <form method="POST">
+      {{ form.hidden_tag() }}
+      {% for error in form.code.errors %}
+      <p>{{ error }}</p>
+      {% endfor %}
+      <p>
+        {{ form.code.label }} {{ form.code() }}
+      </p>
+      <p>
+        <input type="submit" value="Submit">
+      </p>
+    </form>
+  </body>
+</html>
diff --git a/web.py b/web.py
index a5325ae409d6fbaa62f94366bb9aa24e27bfeea1..6024df0075bb64cf55d20cfd8acb3a7326362168 100644 (file)
--- 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()