template error in html forms
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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: template error in html forms
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 wrote: > Please check your template path in settings.py. > > > > > On Wed, Feb 1, 2012 at 5:29 PM, TANYA 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: template error in html forms
yes, the path is already there. Maybe the problem is either in views.py or url.py file if changed it gives different error, but i dont know what to look for in those two files. On Wed, Feb 1, 2012 at 2:40 PM, yati sagade wrote: > 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 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 wrote: >> >>> Please check your template path in settings.py. >>> >>> >>> >>> >>> On Wed, Feb 1, 2012 at 5:29 PM, TANYA 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Yati Sagade <http://twitter.com/yati_itay> > > (@yati_itay <http://twitter.com/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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: template error in html forms
os.path.join(PROJECT_PATH, 'templates'), solved the error but the old error with search is still there. On Wed, Feb 1, 2012 at 3:00 PM, yati sagade wrote: > I've never run in to a TemplateError for anything other than what I > pointed out - maybe in the settings module it is ".../templates" and the > name of the directory is "template" (note the 's' in the end) or the other > way round. Anyway, check for any misspelling in the template name itself - > or whether the template 'search_results.html' is directly under the > template directory and not under any subdirectory therein. > > If you could post the entire debug info (Also the one at the far bottom of > the error page), it might be helpful for us. > > > On Wed, Feb 1, 2012 at 8:22 PM, TANYA wrote: > >> yes, the path is already there. Maybe the problem is either in views.py >> or url.py file if changed it gives different error, but i dont know what to >> look for in those two files. >> >> >> On Wed, Feb 1, 2012 at 2:40 PM, yati sagade wrote: >> >>> 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 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 wrote: >>>> >>>>> Please check your template path in settings.py. >>>>> >>>>> >>>>> >>>>> >>>>> On Wed, Feb 1, 2012 at 5:29 PM, TANYA 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+unsubscr...@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 >>
Re: template error in html forms
thanks, the template error went away but adding this code to views.py still gives search 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}) Which views.py should i add that code to? -- mysite/views.py OR mysite/books/views.py ?? Should every folder in mysite have the path set? I mean to ask if I should have "os.path.join(PROJECT_PATH, 'models')," for databse folder and "os.path.join(PROJECT_PATH, 'picture')," for my jpg images and " os.path.join(PROJECT_PATH, 'test'), for the test files and os.path.join(PROJECT_PATH, 'documentation'), for documentation. Maybe this is a silly question but its not very clear what to do for the path. thanks. On Wed, Feb 1, 2012 at 5:51 PM, Joel Goldstick wrote: > > > On Wed, Feb 1, 2012 at 10:00 AM, yati sagade wrote: > >> I've never run in to a TemplateError for anything other than what I >> pointed out - maybe in the settings module it is ".../templates" and the >> name of the directory is "template" (note the 's' in the end) or the other >> way round. Anyway, check for any misspelling in the template name itself - >> or whether the template 'search_results.html' is directly under the >> template directory and not under any subdirectory therein. >> >> If you could post the entire debug info (Also the one at the far bottom >> of the error page), it might be helpful for us. >> >> >> On Wed, Feb 1, 2012 at 8:22 PM, TANYA wrote: >> >>> yes, the path is already there. Maybe the problem is either in views.py >>> or url.py file if changed it gives different error, but i dont know what to >>> look for in those two files. >>> >>> >>> On Wed, Feb 1, 2012 at 2:40 PM, yati sagade wrote: >>> >>>> 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 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 wrote: >>>>> >>>>>> Please check your template path in settings.py. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Feb 1, 2012 at 5:29 PM, TANYA 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 Exceptio
cannot connect to postgresql database
hello, i am new to python but want to learn a framework like django so i installed it on ubuntu but cannot connect to the postgresql databasei done know if this is postgresql problem or ubuntu problem or django? where should i ask for help to connect django to postgresql? i follow the tutorial on djangobook.com -- CHEERS, 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot connect to postgresql database
I follow this page http://www.djangobook.com/en/2.0/chapter02/ but didnt install django in /home/tanya/. I put it in different place /home/tanya/learndjango/Django-1.3.1 but I start project in "learndjango". I install Postgresql with apt-get so Postgresql is not in this same folder. The page says "Put your code in some directory outside of the document root." so will that be causing problems with the database? On Wed, Nov 23, 2011 at 2:51 PM, Simon Riggs wrote: > On Wed, Nov 23, 2011 at 1:42 PM, TANYA wrote: > >> hello, i am new to python but want to learn a framework like django so >> i installed it on ubuntu but cannot connect to the postgresql >> databasei done know if this is postgresql problem or ubuntu >> problem or django? where should i ask for help to connect django to >> postgresql? i follow the tutorial on djangobook.com > > We need to know more before anybody can help you, no matter where the > problem lies. > > -- > Simon Riggs http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- CHEERS, 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot connect to postgresql database
Page not found (404) Request Method: GET Request URL:http://127.0.0.1:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: 1. ^hello/$ The current URL, , didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. is the error when i try the samples from djangobook.com 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot connect to postgresql database
ok, I didnt know. I trry http://127.0.0.1:8000/hello/ and it works. Thankyou. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot connect to postgresql database
I keep seeing this message, KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-tani/ksycoca4" On Thu, Nov 24, 2011 at 9:49 AM, Daniel Roseman wrote: > On Thursday, 24 November 2011 09:39:58 UTC, Tanya wrote: >> >> Page not found (404) >> Request Method: GET >> Request URL: http://127.0.0.1:8000/ >> >> Using the URLconf defined in mysite.urls, Django tried these URL >> patterns, in this order: >> >> 1. ^hello/$ >> >> The current URL, , didn't match any of these. >> >> You're seeing this error because you have DEBUG = True in your Django >> settings file. Change that to False, and Django will display a >> standard 404 page. >> >> is the error when i try the samples from djangobook.com >> >> TANYA > > What in that message could possibly lead you to the conclusion that you > can't connect to Postgres? > -- > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/4E6gZUEbVfkJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- CHEERS, 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to uninstall the django version
I installed django and python in a different directory but it is still using /usr/local/bin and not python 2.7 and gives path error. Should I delete the python2.6 version for it to work with 2.7? On Tue, Nov 22, 2011 at 4:32 PM, Andre Terra wrote: > Ideally, after removing django, you should NOT install it on your > site-packages this time around. > > Instead, install virtualenv[1] and proceed from there. Learn it. It will > pay off! > > Bonus points if you use pip[2][3] as well. > > > > Cheers, > AT > > [1] http://pypi.python.org/pypi/virtualenv > [2] http://pypi.python.org/pypi/pip > [3] > http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/ > > > > > On Tue, Nov 22, 2011 at 2:15 PM, Nikhil Verma wrote: > >> >> Hey ram >> >> If you are in ubuntu (linux/unix) you need to got to >> 1) /usr/local/lib/python2.6/dist-packages >> 2) when you do ls there will be directory called django. >> 3) do rm -rf django. >> By doing this django will be removed.Now you can install any version of >> django you want. >> >> If you are windows you need to program files then python2.x then agin in >> site-packages delete the django folder and you are good to install the >> required version you want.(What i remember ?) >> >> Please specify your environment conditions also. >> >> Hope this may help you !!! >> -- >> Regards >> Nikhil Verma >> +91-958-273-3156 >> >> >> On Tue, Nov 22, 2011 at 5:39 PM, ram wrote: >> >>> i want to uninstall my django version (1.3.1) and again i want to >>> install the same version.can any one say me how to solve it. >>> >>> -- > 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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
filesystem path in settings.py
# Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" MEDIA_ROOT = '' I want to upload css files and images so must I put them in /home/media or /home/my/media/path/ ? Should the filesystem path in settings.py be changed or should MEDIA_ROOT be left empty? -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: filesystem path in settings.py
I read it but after following all steps in it the error still remains. '/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode' I did symlink to /usr/bin/local but still get path error. Please help. On Fri, Nov 25, 2011 at 4:44 AM, Timothy Makobu wrote: > And this too http://www.djangobook.com/en/2.0/ > > > On Fri, Nov 25, 2011 at 7:41 AM, Timothy Makobu < > makobu.mwambir...@gmail.com> wrote: > >> Hi, >> >> Please read this whole thing >> https://docs.djangoproject.com/en/dev/howto/static-files/ >> >> >> On Fri, Nov 25, 2011 at 6:28 AM, TANYA wrote: >> >>> # Absolute filesystem path to the directory that will hold user-uploaded >>> files. >>> # Example: "/home/media/media.lawrence.com/media/" >>> MEDIA_ROOT = '' >>> >>> I want to upload css files and images so must I put them in /home/media >>> or /home/my/media/path/ ? Should the filesystem path in settings.py be >>> changed or should MEDIA_ROOT be left empty? >>> >>> -- >>> 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+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >> >> > -- > 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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.