I get a 403 error when I comment out csrf_example as such:

auth/views.py
from django.http import HttpResponse
from django.utils import simplejson
#from django.views.decorators.csrf import csrf_exempt

#@csrf_exempt
def json_api(request):
  return HttpResponse(simplejson.dumps(request), mimetype="application/
json")

Here is my urls.py

url(r'^auth/', 'auth.views.json_api'),

Once I uncomment the two csrf_exempt statements, I get the 500 error?
Any ideas?



On Mar 2, 6:57 am, Thomas Orozco <g.orozco.tho...@gmail.com> wrote:
> You seem to have no 500.html page.
>
> This traceback won't actually show the error that happened, but error out
> on the fact that it can't find a template to display the 500 error.
>
> 1. Are you running DEBUG = True?
> 2. Wouldn't you rather want to simplejson.dum
>
>
>
>
>
>
>
>
>
> > I have never used csrf_exempt before.  I keep experiencing a traceback
> > with 1.3.1, which may be self-induced. Here is my views file:
>
> > auth/views.py
> > from django.http import HttpResponse
> > from django.utils import simplejson
> > from django.views.decorators.csrf import csrf_exempt
>
> > @csrf_exempt
> > def json_api(request):
> >    return HttpResponse(simplejson.dumps(request),
> > mimetype="application/json")
>
> > When I do a curl:
>
> > curl -i -X POST -d '{"screencast":{"subject":"tools"}}'
> >http://127.0.0.1:8000/auth/
>
> > I experience 500 Internal Server Error:
>
> > Traceback (most recent call last):
>
> >  File "/Library/Python/2.7/site-packages/django/core/servers/
> > basehttp.py", line 283, in run
> >    self.result = application(self.environ, self.start_response)
>
> >  File "/Library/Python/2.7/site-packages/django/core/handlers/
> > wsgi.py", line 272, in __call__
> >    response = self.get_response(request)
>
> >  File "/Library/Python/2.7/site-packages/django/core/handlers/
> > base.py", line 169, in get_response
> >    response = self.handle_uncaught_exception(request, resolver,
> > sys.exc_info())
>
> >  File "/Library/Python/2.7/site-packages/django/core/handlers/
> > base.py", line 218, in handle_uncaught_exception
> >    return callback(request, **param_dict)
>
> >  File "/Library/Python/2.7/site-packages/django/utils/decorators.py",
> > line 93, in _wrapped_view
> >    response = view_func(request, *args, **kwargs)
>
> >  File "/Library/Python/2.7/site-packages/django/views/defaults.py",
> > line 30, in server_error
> >    t = loader.get_template(template_name) # You need to create a
> > 500.html template.
>
> >  File "/Library/Python/2.7/site-packages/django/template/loader.py",
> > line 157, in get_template
> >    template, origin = find_template(template_name)
>
> >  File "/Library/Python/2.7/site-packages/django/template/loader.py",
> > line 138, in find_template
> >    raise TemplateDoesNotExist(name)
>
> > --
> > 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.

Reply via email to