skip to Main Content

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


  1. Because that’s what that file has been called long before Django even existed.

    Login or Signup to reply.
  2. 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.

    It isn’t, Django recommends not to name pages with an extension. The basic path used is:

    #    🖟🖟 empty
    path('', views.index, name='index')

    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 named foo.txt, and you accessed it with domain.com/foo.txt. Now if one visited the domain.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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search