0

I read file from static folder like this :

<img src="/static/images/book1.png" ">

but I need read files from any where like this:

<img src="C:/Carimage/images/book2.jpg" >
<img src="d:/floweimage/files/images/book2.jpg" >
<img src="e:/Camera/files/images/book3.jpg" >
and
.
.
.
.

how ca i do this?

Tomy
  • 225
  • 5
  • 18
  • Does this answer your question? [How to serve static files in Flask](https://stackoverflow.com/questions/20646822/how-to-serve-static-files-in-flask) – forkdbloke Dec 10 '19 at 12:57
  • i have seen this before, but my problem is that I have many folders path and Not Fixed. – Tomy Dec 10 '19 at 13:35
  • best practice says that you need to group all your static files into folders and keep them accessible in one location OR the post says that you need to make them frontend with nginx. – forkdbloke Dec 10 '19 at 13:38

1 Answers1

1

Best practice says that you need to group all your static files into folders and keep them accessible in one location OR the post says that you need to make them frontend with nginx.

Excerpt taken from Web servers, Web servers, Web servers states perfectly why there needs to be seperation of static and dynamic files, more over, the reasoning behind maintaining a web-server for serving static files and not File systems.

The practice of separting static from dynamically generated content in web applications. The reasoning behind this best practice is that there is no purpose in using a web server capable of executing dynamically generated content (e.g. Java, .NET), when static content is perfectly processed by a web server without these features requiring a fraction of the resources to run. In essence, it's wasteful to serve static content through a web server with dynamic generating capabilities.

Web server performance as it pertains to dynamic content generation (e.g. applications written in Java, .NET, Python, Ruby) is addressed until part III of the book, in this section I will concentrate on issues related to web servers used for dispatching static content (e.g. images, HTML files, JavaScript files, etc).

The first question that probably comes to mind when addressing web servers for dispatching static content is why there are so many options to choose from ? For such a simple task of reading static content from a file system and sending it to a requesting user, there are easily more than a dozen web servers to choose from. Why ? To answer this, it's necessary to dive deeper into the architecture of a web server than in the previous chapter on key technologies.

A web server constantly performs I/O operations to read static content from a file system, static content which it then has to place on a network so it can reach the requesting user. Attending even 2 or 3 requests per second makes a web server an extremely busy piece of software. For this reason the majority of web servers are multi-threaded, designed to perform asynchronous I/O operations and use caching, among other techniques -- in case you're unfamiliar with some of these last concepts, they're described in chapter 1 of the book fundamental performance and scalability concepts .

forkdbloke
  • 1,505
  • 2
  • 12
  • 29