Z
Z
zontik2016-01-05 00:13:28
Django
zontik, 2016-01-05 00:13:28

How to display the files of a folder on the server using Django with access restricted to unregistered visitors?

On the server (ubuntu 14.04 server), where the Django site will be, there is a documentation folder (there are subfolders).
I want to organize access to documentation using this site only for users registered on the site.
If you put the documentation in the static folder , then everyone can access it through a direct link like http://site/static/test.pdf.
Please tell me how can this be done?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2016-01-05
@zontik

You restrict access through the usual authorization to the site.
And then, upon request to a specific URL, you return the content of your documentation.
In this case, you can store documents anywhere, even in blob database fields.

A
Alexey, 2016-01-05
@MAKAPOH

In theory, nginx with the x-accel-redirect setting will suit you . The Internet is full of articles on this topic. Search for "nginx controlled download". For example here or here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question