Home  >  Q&A  >  body text

python - ImportError:from flask_wtf import FlaskForm

大家好,关于flask_wtf,官网上的实例

from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired

class MyForm(FlaskForm):
    name = StringField('name', validators=[DataRequired()])

第一行这样的引入方式,我怎么尝试不成功?在pytone IDE中提示:

ImportError: cannot import name FlaskForm


如果按常规的引入方式:

from flask_wtf import Form

pythone IDE是没问题,但在pycharm中,会有异常提示:

This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items


以上,求解?

  1. 官网的例子是错的吗?

  2. pycharm中为什么公有波浪提示?

阿神阿神2741 days ago1111

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:37:15

      The example on the
    1. official website is correct, but it is version 0.13. You are viewing the documentation of latest, and the address of version 0.12 is https://flask-wtf.readthedocs..., but the problem is that the highest on pypi is only 0.12 , that is to say, although there is version 0.13 now, the author has not failed to publish it, but the documentation has been updated. If you want to install the latest version, you have to use the source code to install it

    2. The wavy lines in PyCharm indicate that the module is not used in the current file

    reply
    0
  • Cancelreply