Can I use Django to prevent direct access to an image file?

后端 未结 2 559
甜味超标
甜味超标 2021-01-19 17:22

I\'d like to prevent my web users from simply right clicking an image and copying/sharing the URL. Certain authenticated users have access to certain images, and I\'d like

2条回答
  •  执念已碎
    2021-01-19 17:58

    You might be interested in XSendfile.

    This is most [elegant and] performance choice IMO: actual files will be served by you webserver, while access control to this files will be done using your Django app.

    You may google for "django xsendfile", there are lot of useful posts.

提交回复
热议问题