twisted.web and Method Not Allowed

Today I was developing a little application using Python’s Twisted framework. Everything was going as well as could be expected until I tried to POST some data to the application.

“Method Not Allowed
Your browser approached me (at /) with the method “POST”. I only allow the methods here.”

Googling for the answer, I found suggestions to add the following line to my application:
allowedMethods = (‘GET’, ‘POST’)
Unfortunately that doesn’t work by itself.

exarkun on irc.freenode.net/#twisted.web said my application was probably missing a render_POST method, which was correct. The problem was fixed by adding:
render_POST = render_GET
after my render_GET() method.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top