Question:
What makes index.html have such kind of name in Django?

Problem

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.


Solution

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 visits 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.


Answered by: >Willem Van Onsem

Credit: >StackOverflow


Blog Links: 

>How do I customize controller actions in Laravel Jetstream?

>Run Laravel Project to Active Local Server

>How to show encrypted user id in URL in Laravel?

>How to fix Laravel LiveWire listener?


Nisha Patel

Nisha Patel

Submit
0 Answers