0

I am trying to design a site using Flask for a store and need to serve the customers with lots of product pictures.
I came across this stack overflow answer that said:

In production, you don't want to serve static files using the flask server. I suggest you use a proper web server to do that

What does a "proper web server" mean and how does one set that up?

Currently, I have the images served like this - example:

<img class="d-block w-100" src="{{url_for('static', filename='/images/prducts/full/1.jpg' )}}" alt="First slide">
<img class="d-block w-100" src="{{url_for('static', filename='/images/prducts/full/2.jpg' )}}" alt="Second slide">
Rr9
  • 33
  • 1
  • 6
  • `flask` should run with web server `apache`, `nginx` or other which can serve static files much faster. See [Full Stack Python](https://www.fullstackpython.com/) and [Web Servers](https://www.fullstackpython.com/web-servers.html) and [WSGI Servers](https://www.fullstackpython.com/wsgi-servers.html) - there is example config for `nginx` which runs `wsgi server` which runs `flask` – furas Aug 03 '20 at 10:28
  • BTW: you don't have to change code in HTML when you use `apache`, `nginx`, etc. so you still use `{{url_for('static', filename=... ) }}`. Request from client's browser goes first to `apache`/`nginx` which sends to client all files with url `/static` and other urls sends to `flask` which generates pages, send back to `apache`/`nginx` and it sends it back to client. – furas Aug 03 '20 at 11:08

0 Answers0