realpython / flask-boilerplate

Boilerplate template for a Python Flask application with Flask-SQLAlchemy, Flask-WTF, Fabric, Coverage, and Bootstrap
http://www.flaskboilerplate.com
Apache License 2.0
1.53k stars 535 forks source link

WTForms import error on TextField #56

Closed satanb4 closed 1 year ago

satanb4 commented 2 years ago

There is an error when running app.py:-

Traceback (most recent call last):
  File "D:\Projects\Technothon 2022\HelpR\app.py", line 9, in <module>
    from forms import *
  File "D:\Projects\Technothon 2022\HelpR\forms.py", line 2, in <module>
    from wtforms import TextField, PasswordField
ImportError: cannot import name 'TextField' from 'wtforms' (D:\Projects\Technothon 2022\HelpR\venv\lib\site-packages\wtforms\__init__.py)

This is caused in python==3.10.1 and WTForms 3.0.1 having deprecated the TextField method This can be resolved by either pinning WTForms==2.3.3 in requirements.txt or updating from TextField to StringField in forms.py Please advice which method we would like to use, I can perform the necessary change to rectify this issue.

aaronleetw commented 2 years ago

I made a pull request to update everything to 2022-level. here It includes this update. If anyone's interested.