S
S
Solo__n2020-06-19 11:00:11
Django
Solo__n, 2020-06-19 11:00:11

How to embed html page from specified folder in Django (page not in project folder)?

The question is as follows:
There is a separate folder in which different html files with analytics will be generated.
It is necessary to create a page in Django on which there will be links to all these pages.
and by clicking on the link the page should open (well, of course)

Tell me, please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-06-19
@fox_12

Put it in a folder In django, do something like my_files
= os.listdir('<path to daddy>') - and display this list by adding some url

my_files = os.listdir('<путь до папочки>')
context['links'] =  [f'/некий урл/{my_file}' for my_file in my_files]

And in nginx you organize the distribution of files simply as statics at a given url
location /некий урл
{
    alias /путь/до/папки;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question