>  Q&A  >  본문

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일 전1109

모든 응답(1)나는 대답할 것이다

  • 伊谢尔伦

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

    1. 공식 홈페이지의 예시는 맞지만, 버전 0.13입니다. latest 문서를 보고 계시고, 버전 0.12의 주소는 https://flask-wtf.readthedocs... , 하지만 문제가 있습니다. pypi의 최고 버전은 0.12에 불과합니다. 이는 현재 버전 0.13이 있지만 작성자가 게시에 실패한 것은 아니지만 문서가 업데이트되었음을 ​​의미합니다. 최신 버전을 설치하려면, 설치하려면 소스 코드를 사용해야 합니다

    2. PyCharm의 물결선은 해당 모듈이 현재 파일에서 사용되지 않음을 나타냅니다.

    회신하다
    0
  • 취소회신하다