new files
This commit is contained in:
parent
1b0c314372
commit
cc95d23e73
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
venv
|
BIN
__pycache__/app.cpython-39.pyc
Normal file
BIN
__pycache__/app.cpython-39.pyc
Normal file
Binary file not shown.
19
app.py
Normal file
19
app.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from flask import Flask, render_template
|
||||||
|
from flask_wtf import FlaskForm
|
||||||
|
from wtforms import StringField
|
||||||
|
from wtforms.validators import DataRequired
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def hello_world():
|
||||||
|
form = MyForm(meta={'csrf': False})
|
||||||
|
return render_template('index.html', form=form)
|
||||||
|
|
||||||
|
class MyForm(FlaskForm):
|
||||||
|
name = StringField('name', validators=[DataRequired()])
|
||||||
|
|
||||||
|
@app.route('/submit', methods=['GET', 'POST'])
|
||||||
|
def submit():
|
||||||
|
print ("Success!")
|
||||||
|
return render_template('index.html')
|
15
templates/index.html
Normal file
15
templates/index.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>THIS IS A TITLE</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form method="POST" action="/">
|
||||||
|
{{ form.csrf_token }}
|
||||||
|
{{ form.name.label }} {{ form.name(size=20) }}
|
||||||
|
<input type="submit" value="Go">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user