Wednesday, February 1, 2012

Re: template error in html forms

in settings.py, in the TEMPLATE_DIRS setting, add the absolute path to your templates directory - something like "/path/to/project/dir/template". This MUST be an absolute path. And if your modifying this setting for the first time, be sure to leave a comma (,) in the end of that path (Sorry if you knew that already :))

On Wed, Feb 1, 2012 at 7:59 PM, TANYA <taninat@gmail.com> wrote:
the installed apps has     'mysite.books', in the path and the html files are in a directory under mysite project directory. Is that correct?



On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai <i.ankit.rai@gmail.com> wrote:
Please check your template path in settings.py.




On Wed, Feb 1, 2012 at 5:29 PM, TANYA <taninat@gmail.com> wrote:
In views.py, when I add this code gives template error.
def search(request):     error = False     if 'q' in request.GET:         q = request.GET['q']         if not q:             error = True         else:             books = Book.objects.filter(title__icontains=q)             return render_to_response('search_results.html',                 {'books': books, 'query': q})     return render_to_response('search_form.html',         {'error': error})

I have created search_form.html and search.html and put it in "template" directory but get this error ,

TemplateDoesNotExist at /search/

search_form.html
Request Method: GET
Request URL: http://127.0.0.1:8000/search/
Django Version: 1.3.1
Exception Type: TemplateDoesNotExist
Exception Value:
search_form.html
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/loader.py in find_template, line 138
Python Executable: /usr/bin/python

--
TANYA

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Ankit Rai


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
TANYA

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Yati Sagade

(@yati_itay)


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment