Jul-07-2020, 12:06 PM
Hello Coders!
I'm a student and I'm trying to complete a project for my course. I'm creating a small blog and now I'm working on the recipe page. The project is in Python+Flask+MongoDB.
I could do almost everything, I'm just having problems with a file. I have the picture of the recipe in a folder, so let's say the file is:
"/static/images/5f034b69b91c57308938cf82.png"
The id 5f034b69b91c57308938cf82 is the object id in MongoDB, I renamed the file in that way when I added the recipe.
Now in HTML file, recipe.html, I'm trying to show also the image of the recipe, and I can get the name using {{recipe._id}} but I don't know the extension, it might be any image extension. How could I get the following?
<img src="/static/images/{{FILE+EXT}} alt="RecipePic" />
I know the file name but not the extension, and I'm finding it difficult since jinja2 is giving me always errors.
Thank you in advance!!! :D
I'm a student and I'm trying to complete a project for my course. I'm creating a small blog and now I'm working on the recipe page. The project is in Python+Flask+MongoDB.
I could do almost everything, I'm just having problems with a file. I have the picture of the recipe in a folder, so let's say the file is:
"/static/images/5f034b69b91c57308938cf82.png"
The id 5f034b69b91c57308938cf82 is the object id in MongoDB, I renamed the file in that way when I added the recipe.
Now in HTML file, recipe.html, I'm trying to show also the image of the recipe, and I can get the name using {{recipe._id}} but I don't know the extension, it might be any image extension. How could I get the following?
<img src="/static/images/{{FILE+EXT}} alt="RecipePic" />
I know the file name but not the extension, and I'm finding it difficult since jinja2 is giving me always errors.
Thank you in advance!!! :D