[Answered ]-How to serve a text file at root with Django

2👍

Put it as the last urlpattern in your urls.py to ensure it doesn’t sccop up everything. It should not have the trailing / either, i.e.

url('^(?P<path>.*)/?$', san.views.FileDownload.as_view()),

This will match the request “/YOUR_FILE.txt“, and is also case-insensitive.

url(r'^(?i)YOUR_FILE.txt$', san.views.FileDownload.as_view()),
👤Matt

Leave a comment