Hi,
I was following tutorial from official docs step by step.

So on part 4, at writing and processing simple form I am stuck with
something. (here — 
http://docs.djangoproject.com/en/dev/intro/tutorial04/#write-a-simple-form).

I am writing my results view and pointing at it from polls/urls.py.
And I am getting 500 error. Whatever I write in results view. Now, if
I point matching regex from urls.py to some other view, like “details"
that I've created before that, then it works.

Here is the code:

polls/urls.py:

from django.conf.urls.defaults import *

urlpatterns = patterns('mysite.polls.views',
    (r'^$', 'index'),
    (r'^(?P<poll_id>\d+)/$', 'detail'),
    (r'^(?P<poll_id>\d+)/results/$', 'results'),
    (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
)

relevant view from polls/views.py (and it doesn't really matter what
do I write there, anyway I get 500 error):

def results(request, poll_id):
    p = get_object_or_404(Poll, pk=poll_id)
    return render_to_response('polls/results.html', {'poll': p})

Here is an output of error message:

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/django/core/servers/
basehttp.py", line 277, in run
    self.result = application(self.environ, self.start_response)

  File "/usr/lib/python2.5/site-packages/django/core/servers/
basehttp.py", line 634, in __call__
    return self.application(environ, start_response)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/
wsgi.py", line 239, in __call__
    response = self.get_response(request)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/
base.py", line 128, in get_response
    return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/
base.py", line 160, in handle_uncaught_exception
    return callback(request, **param_dict)

  File "/usr/lib/python2.5/site-packages/django/views/defaults.py",
line 88, in server_error
    t = loader.get_template(template_name) # You need to create a
500.html template.

  File "/usr/lib/python2.5/site-packages/django/template/loader.py",
line 80, in get_template
    source, origin = find_template_source(template_name)

  File "/usr/lib/python2.5/site-packages/django/template/loader.py",
line 73, in find_template_source
    raise TemplateDoesNotExist, name

TemplateDoesNotExist: 500.html



Please suggest what I could do.

What I've already done is:
>From within urls.py I pointed ^(?P<poll_id>\d+)/results/$ to 'detail'
and it works. It calls detail view in views.py and shows whatever that
view is telling to show.

I've tried to change results view in views.py and it didn't work in
any case. I even tried simple:

from django.http import HttpResponse

def results(request):
    return HttpResponse("Hello, world. You're at the poll index.").

and it didn't work too.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to