How does Django restrict access to pictures?

problem description

when Django is deployed, static resources are public. You can directly copy the url corresponding to the image to the browser address bar to access the image. Now if you want to add restrictions to prevent this operation, you must pass some kind of authentication before accessing the image. Do you have any good ideas?

Nov.24,2021

copy the URL address to view the picture, which can definitely be done, otherwise how can your resource browser get it? I guess you are afraid of others traversing your static resources. You can replace the static resource ID with a random number (such as uuid)


plus middleware to verify the referer of the request header for requesting picture resources, but this thing protects against gentlemen but not villains.

Menu