Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Template File not found

So I am trying to open a template from…

enter image description here

But the template file is not shown as below…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

from django.http import HttpResponse
from django.shortcuts import render


# Create your views here.
def index(request):
    return render(request, "home/index.html")

Weird thing is that my webpage still works, and when I delete that function it does not.

Here is some additional Info…

settinbgs.py

enter image description here

# Application definition

INSTALLED_APPS = [
    'project_long_page',
    'about',
    'home',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

home/urls.py

enter image description here

from django.urls import path
from . import views

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

>Solution :

Your templates folder should be within your app folder home (under about), otherwise Django won’t find it. Check out https://django-project-skeleton.readthedocs.io/en/latest/structure.html for the proper file structure. My guess is the same could be said for the other folders withing your templates folder. You can have a templates folder in your root, but I don’t think this is what you will need in your case.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading