|
@ -6,10 +6,10 @@ from wtforms import ( |
|
|
SubmitField, |
|
|
SubmitField, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
# config me here |
|
|
# config me here |
|
|
APP = Flask(__name__, static_folder="static") |
|
|
APP = Flask(__name__, static_folder="static") |
|
|
APP.config["IMAGE_FOLDER"] = "static/images" |
|
|
APP.config["IMAGE_FOLDER"] = "static/images" |
|
|
ALLOWED_FILES = ["jpg", "png", "gif", "webp"] |
|
|
ALLOWED_FILES = ["jpg", "png", "gif", "webp"] |
|
|
|
|
|
|
|
|
# don't config these lines |
|
|
# don't config these lines |
|
|
APP.config["SECRET_KEY"] = os.urandom(24) |
|
|
APP.config["SECRET_KEY"] = os.urandom(24) |
|
@ -17,8 +17,8 @@ APP.config["SECRET_KEY"] = os.urandom(24) |
|
|
class ImageUploadForm(FlaskForm): |
|
|
class ImageUploadForm(FlaskForm): |
|
|
"""Image upload form.""" |
|
|
"""Image upload form.""" |
|
|
image = FileField( |
|
|
image = FileField( |
|
|
"Upload an image:", |
|
|
"image:", |
|
|
validators=[FileAllowed(ALLOWED_FILES, "Images only!")], |
|
|
validators=[FileAllowed(ALLOWED_FILES, f"Images only, please use any of the following file extensions: {(", ").join(ALLOWED_FILES)}")], |
|
|
) |
|
|
) |
|
|
submit = SubmitField("Submit") |
|
|
submit = SubmitField("Submit") |
|
|
|
|
|
|
|
|