Hi,

I have Django running under Apache with mod_wsgi.  I've got a simple URL 
handler that looks like this:

def handler(request):
    response = None

    if request.method == 'POST' or request.method == 'PUT':
        response = HTTPResponse(status=201)
    elif request.method == 'GET':
        response = HttpResponse("Success")
    else:
        raise Http404

    return response

My django.wsgi looks like this:

import os
import sys

sys.path.append('/Users/Patrick/codestreet/src/rest')
 
os.environ['DJANGO_SETTINGS_MODULE'] = 'server.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

When I connect to the URL for the handler with a GET like this:

        request = urllib2.Request(self.URL)

it works fine, returning a 200.  However, when I connect with a POST like this:

        request = urllib2.Request(self.URL,self.data)

I get an exception thrown with a 500 code and this in the Apache error log:

[Mon Jan 04 16:20:08 2010] [error] [client ::1] mod_wsgi (pid=48698): Exception 
occurred processing WSGI script 
'/Users/Patrick/codestreet/src/rest/django.wsgi'.
[Mon Jan 04 16:20:08 2010] [error] [client ::1] IOError: failed to write data

Do I have something misconfigured?

Thanks,

Patrick

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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