I’m not a native speaker and I don’t understand why the standard name of the initial page in Django applications is index.html. Can someone explain in simple words why this is so, and not, for example, home.html
I’m trying to find out the answer to my question. I just need a verbal explanation
2
Answers
Because that’s what that file has been called long before Django even existed.
It isn’t, Django recommends not to name pages with an extension. The basic path used is:
so for the "outside world", we use the empty path, and you can name the view whatever you like.
The tradition to name such file
index.html
originates from the fact that in the very old days, web servers were often seen as "file repositories". So a lot of webservers stored a file namedfoo.txt
, and you accessed it withdomain.com/foo.txt
. Now if one visited thedomain.com/
itself, one expects a "list" of the files available, so an index, since a book contains often also a list of the content named the "index" section.