Keep or drop index.html from Django?
Thomas Jollans
tjol at tjol.eu
Sat Oct 28 05:02:52 EDT 2017
On 28/10/17 08:55, Christopher Reimer wrote:
> Greetings,
>
> When I set up my static website using Pelican several years ago, many URLs ended with index.html. Now that I'm looking at Django, I got a small set of URLs working with and without index.html to point to the correct pages.
>
> I read somewhere that the Django philosophy was to keep the URLs as clean as possible (i.e., no *.html at the end). I can go either way with this. What's the best practice for this?
Best practice is to keep your URLs working in one way or another.
As you said, with Django it's unusual to add artificial file endings
like ".html". I'd recommend setting up the URLs in a way that makes
sense to you now (probably without index.html and so on) and set up HTTP
301 redirects to get your visitors to the right place. (Probably best in
the web server configuration, but you can do this in Django)
-- Thomas
More information about the Python-list
mailing list