django not recognizing my index.html page, stuck on the install worked

Question:

I have an index.html page made and also referenced in views.py and urls.py. For some reason, the home page at http://127.0.0.1:8000/ only shows the install worked default page.

Am I calling it wrong? I followed the installation step-by-step and it’s not working at all

views.py:

from django.shortcuts import render

# Create your views here.
def index(request):
    return render(request, 'index.html')
from django.urls import include, path
from django.contrib import admin
from . import views

urlpatterns = [
    path('', views.index, name='index'),
]

index.html

<!DOCTYPE html>
<html lang="en">

<head>
</head>

<body>
   
<p>index</>
</body>

</html>
Asked By: akira

||

Answers:

In your urls.py project, you have to include your urls.py from your app. Something like:

myproject/urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('', include('proteindata.urls')),
    path('admin/', admin.site.urls),
]
Answered By: Corralien
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.