I have this code in my app view
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
@login_required(login_url="login/")
def home(request):
return render(request, "home.html")
Here also is my project url
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('log.urls')),
url(r'^login/$', views.login, {'template_name': 'login.html'}),
url(r'^logout/$', views.logout, {'next_page': '/login'}),
]
So i have the templates folder in my project root url and i have also configured TEMPLATES DIR in my settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
......
......
......
],
},
},
However, when i try to access my homepage,i expect it to render my custom login page(login.html). But it always say TemplateDoesNotExist.
I also tried putting the template folder inside an app. But the login page doesnt get rendered still.
I need help urgently.Thanks!!!!