Can anyone help me in Template error?

24 views
Skip to first unread message

utpalbr...@gmail.com

unread,
Oct 14, 2017, 5:49:53 AM10/14/17
to Django users
my code that caused an error :
///
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
# Create your views here.

def home(request) :
    return render(request,'login.html',context)
///
above code is in my views.py of my app name "accounts"
my project name "tutorial"
All my directories are :

tutorial->
     accounts
     tutorial
     manage.py
and accounts->
            migrations
            __pycache__
            templates
            admin.py
            apps.py
            __init__.py
            models.py
            tests.py
            urls.py
            views.py

and templates->
             accounts->
                     login.py

Dylan Reinhold

unread,
Oct 14, 2017, 7:48:43 AM10/14/17
to django...@googlegroups.com
What is the error?
Also in your file tree you show your templates/accounts/login.py, you want it to be .html to match to template name in the render.

Dylan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e74b849c-1757-43ca-9bea-e5820cc06f85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

yingi keme

unread,
Oct 15, 2017, 4:27:59 AM10/15/17
to django...@googlegroups.com
What exactly is the error you are trying to fix?

Yingi Kem
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

utpalbr...@gmail.com

unread,
Oct 15, 2017, 6:22:23 AM10/15/17
to Django users
even though i have correct to login.html----while running server and when i try to open accounts page
it pops an error show below--
"no templates found"
in my browser
 

yingi keme

unread,
Oct 15, 2017, 6:56:06 AM10/15/17
to django...@googlegroups.com
Check the extension. Sometimes editor will save the file as .htm while your are referencing .html in your views. This can give a "No templates found" exception too.


Yingi Kem
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

harsh sharma

unread,
Oct 18, 2017, 3:54:59 AM10/18/17
to Django users
in your template folder -> account  login.py to login .html .. if your html file is login.py 
and you have to specify full path like  
render(request,"accounts/login.html",context)
Reply all
Reply to author
Forward
0 new messages