2👍
✅
url(r'$', views.index, name='index')
matches the end of the string, so basically it will match any url, that’s why your code isn’t working. You need to replace url(r'$', views.index, name='index')
with url(r'^$', views.index, name='index')
so that it will match only empty url
^
asserts position at start of the string
$
asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Source:stackexchange.com