WebFaction
Community site: login faq

Hi all,

I'm trying to set up a Django app to consume Superfeedr feeds.

GET requests work fine, but when Superfeedr sends a POST request, it shows in my access log as having triggered a 500 response, but it never actually runs the code in my Django view.

Any ideas?

Thanks, Tony

asked 29 Jan '11, 11:39

tonyb82
1613
accept rate: 0%


If Django is receiving a POST and has bad/no view data to receive it, there will be a 500 for that request. You should check the access log for an identical time-stamp to see if there was access.

permanent link

answered 29 Jan '11, 12:45

johns
5.4k312
accept rate: 23%

Hi, Thanks for replying,

The request is showing in my access log, but the Django view isn't being run, and there is nothing in the error log.

The strange thing is, the view responds correctly to GET requests on the same URL, just not POST requests.

Thanks, Tony

permanent link

answered 29 Jan '11, 13:33

tonyb82
1613
accept rate: 0%

Could you possibly provide an example of some of the code? The view, url conf, and template code if at all possible.

(29 Jan '11, 13:43) johns

Ok,

URL Conf:

urlpatterns = patterns('turbine.views',

(r'^$', 'feed'),

(r'^superfeedr/(?P<feed_id>\d+)/$', 'superfeedr'),

)

View:

def superfeedr(request, feed_id):

print 'SUPERFEEDR'

if request.method == 'GET':

    print 'GET'

    return HttpResponse('GET OK')

elif request.method == 'POST':

    print 'POST'

    return HttpResponse('POST OK')

When Superfeedr makes a GET request, the print statements show in the error log, but when it makes a POST request, nothing shows in the error log, and the access log shows the request with a 500.

Cheers

(29 Jan '11, 14:03) tonyb82

I'm just wondering if there's anything in Webfaction/Apache that's noticing the request is from another domain and preventing it from hitting Django?

permanent link

answered 29 Jan '11, 13:53

tonyb82
1613
accept rate: 0%

Ah, panic over!

I was sending requests without a trailing slash, which was causing Django problems, and I wasn't seeing any errors because I had DEBUG=True set, so it was never hitting the view and just sending an HTML error page back to Superfeedr.

Wow, that was fun!

Thanks for your help.

permanent link

answered 29 Jan '11, 14:54

tonyb82
1613
accept rate: 0%

Glad you figured it out, thanks for letting us know the outcome. Just so you know we do not block POST or GETs in any way, that is up to the app.

(29 Jan '11, 15:06) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×108
×19
×4
×1

question asked: 29 Jan '11, 11:39

question was seen: 3,947 times

last updated: 29 Jan '11, 15:06

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM