Python Flask - нет модуля с именем "wtforms.csrf" - PullRequest
0 голосов
/ 11 ноября 2018

После установки склянки-wtf с pip, создайте форму ниже

from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email, EqualTo


def Register(FlaskForm):
    username = StringField("Username", validators=[Datarequired(), Length(min = 2, max= 20)])
    email = StringField("Email", validators=[Datarequired(), Email()])
    password = PasswordField("Password", validators=[Datarequired(), Length(min = 6, max= 100)])
    confirm_password = PasswordField("Confirm Password", validators=[Datarequired(), EqualTo('password')])
    submit = SubmitField("Sign Up")

и запущенный python app.py

я получаю ошибку ниже

Traceback (most recent call last):
  File "app.py", line 5, in <module>
    from forms import Registration, Login
  File "D:\python\sublime\flaskdbapp\forms.py", line 1, in <module>
    from flask_wtf import FlaskForm
  File "C:\Users\laravel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask_wtf-0.14.2-py3.7.egg\flask_wtf\__init__.py", line 15, in <module>
    from .csrf import CSRFProtect, CsrfProtect
  File "C:\Users\laravel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask_wtf-0.14.2-py3.7.egg\flask_wtf\csrf.py", line 12, in <module>
    from wtforms.csrf.core import CSRF
ModuleNotFoundError: No module named 'wtforms.csrf'

Не могу найти решение, любезно помогите

...