Try defining the get method.
The "post" method is commonly used in forms, but when you just point your browser to an url the used method is "get"
Вопрос
So this is a simple view that I have written.
class PostTestView(View):
def post(self, request, *args, **kwargs):
print request.POST
return HttpResponse("Hello there")
my urls.py
has this line for the above view :
url(r'^test/create$',PostTestView.as_view(), name='app.views.create_test')
But I get an 405 Http error
when I try to hit http://127.0.0.1:8000/app/test/create
This apparently means that my method post
is not in the defined methods list . But I have defined it as above in my view.
What could possibly be wrong here ? I am clueless
Решение
Try defining the get method.
The "post" method is commonly used in forms, but when you just point your browser to an url the used method is "get"