-2

I am trying to write a simple program that shows a random meme every time you log onto the flask url, my question: Is there an easy way to display the meme on the website? (the memes are in a directory of mine) Thank you!

1 Answers1

0

You can use a number for every image e.g. 1.jpg, 2.jpg, etc. On the server-side you can generate a random number. On the client you need to put a jinja code(in your HTML template):

<img src="{{number}}.jpg" />

Is that simple

Adrian B
  • 1,490
  • 1
  • 19
  • 31
  • I cannot get it to work, every time i try to log onto the server it shows an error message: Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. – LordAliander Nov 04 '21 at 20:55
  • I think this is an error from nginx – Adrian B Nov 05 '21 at 14:14