Open evertears opened 4 years ago
请确认flask_wtf的版本是否是0.14.2
确实是这样,已经解决,谢谢大神。
之前安装了flask_wtf的0.14.2版本就正常运行了,现在换了新的环境安装之后依然报同样的错误。该怎么解决呢?
tom@Evertears:~/flask_code/maple-blog$ python3 runserver.py db init
Traceback (most recent call last):
File "runserver.py", line 25, in <module>
from maple import create_app
File "/home/tom/flask_code/maple-blog/maple/__init__.py", line 11, in <module>
from maple import extension, router, jinja, admin, alias, api
File "/home/tom/flask_code/maple-blog/maple/extension/__init__.py", line 15, in <module>
from flask_wtf.csrf import CSRFProtect
File "/home/tom/.local/lib/python3.6/site-packages/flask_wtf/__init__.py", line 17, in <module>
from .recaptcha import *
File "/home/tom/.local/lib/python3.6/site-packages/flask_wtf/recaptcha/__init__.py", line 2, in <module>
from .fields import *
File "/home/tom/.local/lib/python3.6/site-packages/flask_wtf/recaptcha/fields.py", line 3, in <module>
from . import widgets
File "/home/tom/.local/lib/python3.6/site-packages/flask_wtf/recaptcha/widgets.py", line 5, in <module>
from werkzeug import url_encode
ImportError: cannot import name 'url_encode'
ImportError: cannot import name 'url_encode'
在执行初始化数据库时发生导入错误,请问如何解决?
tom@Evertears:~/maple-blog$ python3 runserver.py db init Traceback (most recent call last): File "runserver.py", line 25, in
from maple import create_app
File "/home/tom/maple-blog/maple/init.py", line 11, in
from maple import extension, router, jinja, admin, alias, api
File "/home/tom/maple-blog/maple/extension/init.py", line 15, in
from flask_wtf.csrf import CSRFProtect
File "/home/tom/.local/lib/python3.5/site-packages/flask_wtf/init.py", line 17, in
from .recaptcha import
File "/home/tom/.local/lib/python3.5/site-packages/flask_wtf/recaptcha/init.py", line 2, in
from .fields import
File "/home/tom/.local/lib/python3.5/site-packages/flask_wtf/recaptcha/fields.py", line 3, in
from . import widgets
File "/home/tom/.local/lib/python3.5/site-packages/flask_wtf/recaptcha/widgets.py", line 5, in
from werkzeug import url_encode
ImportError: cannot import name 'url_encode'