我想创建一个表单,允许使用烧瓶表单发送带有描述的图片。我尝试使用此视频:https ://www.youtube.com/watch?v=Exf8RbgKmhM
但我在启动 app.py 时遇到了麻烦:
➜ website git:(master) ✗ python3.6 app.py
Traceback (most recent call last):
File "app.py", line 10, in <module>
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
ModuleNotFoundError: No module named 'flask.ext'
我不得不替换
flask.ext.uploads
,flask_uploads
但现在我得到了:
Traceback (most recent call last):
File "app.py", line 10, in <module>
from flask_uploads import UploadSet, configure_uploads, IMAGES
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask_uploads.py", line 26, in <module>
from werkzeug import secure_filename, FileStorage
ImportError: cannot import name 'secure_filename'
我的导入和配置如下所示:
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, session, render_template, url_for, redirect, flash, request
from wtforms import Form, fields,TextField, StringField, PasswordField, BooleanField,validators
from wtforms.validators import InputRequired, Email, Length, DataRequired
from flask_wtf import FlaskForm
from flask_uploads import UploadSet, configure_uploads, IMAGES
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
我无法解决这个问题,你知道我能做什么吗?