[英]Trouble with Python and IntelliJ
I'm writing a Flask application in IntelliJ, and for some reason I can't get IntelliJ to recognize Flask extensions. 我正在IntelliJ中编写Flask应用程序,由于某种原因,我无法让IntelliJ识别Flask扩展。 And so this works just fine:
所以这很好用:
from flask import Flask, Response, request
But this does not: 但这不是:
from flask.ext.wtf import Form
It will recognize and autocomplete flask.ext
but not any submodules. 它将识别并自动完成
flask.ext
但不会自动完成flask.ext
模块。
Does anyone know what the problem could be? 有谁知道是什么问题?
More info: 更多信息:
bin/pip install <dependency>
. bin/pip install <dependency>
。 PyCharm has difficulty completing flask.ext...
because all flask.ext
does is proxy imports at runtime, so the built-in static detection is faulty. PyCharm很难完成
flask.ext...
因为flask.ext
所做的只是在运行时导入代理,因此内置的静态检测是有缺陷的。
For future reference, flask.ext
is deprecated in favor of using the actual package import such as from flask_wtf import Form
. 为了将来参考,不建议使用
flask.ext
,而是使用实际的包导入,例如from flask_wtf import Form
。 As of Flask 1.0 it has been removed completely. 从Flask 1.0开始,它已被完全删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.