When I click the Send button nothing happens, I leave a blank field, idem.
routes.py file
from flask import *
from forms import *
app=Flask(__name__)
@app.route('/')
@app.route('/home')
def home():
return render_template('homepage.html', title='Home')#, 404
@app.route('/about')
def about():
return render_template('about.html', title='About')
@app.route('/subscription', methods=['GET', 'POST'])
def sign():
form = LoginForm()
if form.validate_on_submit():
flash('User %s logged in!' % form.user.data)
return redirect('/home')
return render_template('signup.html', title='Sign Up', form=form)
@app.route('/contact')
def contact():
return render_template('contact.html', title='Contact')
@app.route('/turma')
def turma():
return render_template('turminha.html', title='Turma')
if __name__ == '__main__':
app.config.update({'SECRET_KEY': 'guess-it', 'WTF_CSRF_SECRET_KEY': 'guess-it'})
app.run(debug=True)
Forms.py file:
from flask_wtf import FlaskForm
from wtforms import *
from wtforms.validators import DataRequired
class LoginForm(FlaskForm):
"""docstring for LoginForm"""
user = StringField('Username', validators=[DataRequired()])
passw = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Sign Up')
File signup.html:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script><title>GahioGames-{{title}}</title><metacharset="utf-8">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/InscriçãoCSS.css') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="static/img/fallout.ico" rel="shortcut icon" type="image/x-icon">
</head>
<body ng-app='entra'>
<ul id="topo">
<li><a href="homepage.html">Home</a></li>
<li><a href="info.html">Info</a></li>
<li class="drop">
<a href="assuntos.html" class="drop">Assuntos</a>
<div class="cont">
<a href="#">Redes</a>
<a href="#">Hardware</a>
<a href="#">Software</a>
</div>
</li>
<li><a href="contato.html">Contato</a></li>
<li><a href="inscrição.html"><b>Inscreva-se</b></a></li>
</ul>
<br>
<h1>INSCREVA-SE</h1>
<article>
<h4>Para saber de todas nossas novidades!!!</h4>
<form autocomplete="on" name="formula" method="post">
{{ form.hidden_tag() }}
<p> {{ form.user.label }} {{ form.user(size=32) }} </p>
{% for error in form.user.errors %}
<p style="color: red;"> {{ error }} </p>
{% endfor %}
<p> {{ form.passw.label }} {{ form.passw(size=16) }} </p>
{% for error in form.passw.errors %}
<p style="color: red;"> {{ error }} </p>
{% endfor %}
<p>{{ form.submit() }}</p>
<!--<input type="text" name="nome" placeholder="Nome:" required>
<br>
<input type="email" name="email" placeholder="E-mail:" required ng-model='txt'><p ng-show='formula.email.$error.email'>E-mail inválido</p>
<br>
<input type="password" name="senha" placeholder="Senha:" required>
<br>
<button type="submit" class="verde"><a href="mailto: [email protected]?Subject=Ola Pessoa" target='_top'>Enviar</a></button>
<button type="reset" class="red">Limpar</button>-->
</form>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for msg in messages %}
<li>{{ msg }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<h4>Visite nossas outras páginas também!!!</h4>
<a href="https://facebook.com" class="ico"><span class="fa fa-facebook-square"></span></a>
<a href="https://store.steampowered.com" class="ico"><span class="fa fa-steam-square"></span></a>
<a href="https://twitter.com" class="ico"><span class="fa fa-twitter"></span></a>
</article>
<script>
var app = angular.module('entra', []);
</script>
</body>
</html>