python - ImportError:from flask_wtf import FlaskForm
阿神
阿神 2017-04-18 09:35:15
0
1
1100

大家好,关于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中为什么公有波浪提示?

阿神
阿神

闭关修行中......

全部回复(1)
伊谢尔伦
  1. 官网的例子没有错,只不过那是0.13版本,你查看的是latest的文档,而0.12版本的地址是https://flask-wtf.readthedocs...,但是问题是pypi上最高只有0.12,也就是说虽然现在有0.13版本,但是作者没有发不出来,只是文档更新了,如果要安装最新的就得使用源码安装了

  2. PyCharm的波浪线表示该模块在当前文件并没有被使用

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!