There is a site on Django. In order to get tested on one of the services, you need to upload an html file so that it opens at http://saitt.ru/file.html how to do it?

If you upload to the directory / public / - it does not open - Page not found!

If you upload to / public / static, then the file will open via ttp: //saitt.ru/static/file.html

It is necessary that urls.py register something? In urlpatterns?

    2 answers 2

    In the root urls.py (which is in your root application) write

    from django.views.generic import TemplateView urlpatterns = [ ... url(r'^file.html$', TemplateView.as_view(template_name='public/file.html')), ] 
    • Thank you, also a working version! Only with this option file.html should be in templates. And accordingly -> url (r '^ file.html $', TemplateView.as_view (template_name = 'file.html')), - Mikhail Sosnin

    Decided to add nginx.conf to the configuration file

     location /file.html { alias /ПУТЬ/public/static/file.html ; }