You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
514 B

3 years ago
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired
app = Flask(__name__)
3 years ago
3 years ago
@app.route("/")
def hello_world():
3 years ago
form = MyForm(meta={"csrf": False})
return render_template("index.html", form=form)
3 years ago
class MyForm(FlaskForm):
3 years ago
name = StringField("name", validators=[DataRequired()])
3 years ago
3 years ago
@app.route("/submit", methods=["GET", "POST"])
3 years ago
def submit():
3 years ago
print("Success!")
return render_template("index.html")