U
U
uw9352022-01-03 21:13:27
MySQL
uw935, 2022-01-03 21:13:27

Flask. How to upload multiple photos to the database and display them on the page?

Good day

I have a question regarding Flask development, namely working with a database. How can I upload photos (several) to the database, and display them under my post.

Example: Photo Title Description

And there are several such entries. I've been fooling my head all day and can't find anything sensible.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
uw935, 2022-01-04
@uw935

I solved the problem, but not through the database, but through folders, I made it easier: a folder was created (name: record ID) and a photo was thrown there, then I simply output the photo from there, everything worked. Thanks everyone for the help!

P
pcdesign, 2022-01-03
@pcdesign

As for bulk loading, you can take this article as a basis
https://blog.miguelgrinberg.com/post/handling-file...
In relational databases, such storage is usually not practiced.
And, for example, in mongodb, why not.
For convenience, you can use ImageField:
https://docs.mongoengine.org/apireference.html#mon...
And the module responsible for working with Flask and mongoengine:
https://github.com/MongoEngine/flask-mongoengine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question