I'm trying to define a simple form with Flask-WTF. I get TypeError: Error when calling the metaclass bases
. Why am I getting this error?
from flask_wtf import form
class RegisterForm(form):
pass
Traceback (most recent call last):
File "manage.py", line 5, in <module>
from flask_init import app
File "/Users/sapp/Desktop/ude/flask_init/__init__.py", line 12, in <module>
from author import views
File "/Users/sapp/Desktop/ude/flask_init/author/views.py", line 3, in <module>
from form import RegisterForm
File "/Users/sapp/Desktop/ude/flask_init/author/form.py", line 5, in <module>
class RegisterForm(form):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)
You imported the module form
and passed that as a base class of your RegisterForm
. A module is not a valid base class. You were looking for form.Form
, the class Form
in that module.
from flask_wtf.form import Form
class RegisterForm(Form):
pass
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.