Home > Software engineering >  django not recognizing my index.html page, stuck on the install worked
django not recognizing my index.html page, stuck on the install worked

Time:01-08

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>

CodePudding user response:

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),
]
  • Related