Django REST Framework (ModelViewSet), 405 METHOD NOT ALLOWED Django REST Framework (ModelViewSet), 405 METHOD NOT ALLOWED angularjs angularjs

Django REST Framework (ModelViewSet), 405 METHOD NOT ALLOWED


You don't need router in you url mapping, unless you have a customized action other than the following:

    def list(self, request):        pass    def create(self, request):        pass    def retrieve(self, request, pk=None):        pass    def update(self, request, pk=None):        pass    def partial_update(self, request, pk=None):        pass    def destroy(self, request, pk=None):        pass

add this to your views.py:

account_list = AccountViewSet.as_view({    'get': 'list',    'post': 'create'})

in urls.py:

 url(r'^account/$', account_list, name='account-list'),


The problem is with urls.py. Because url(r'^.*$'... comes before url(r'^api/v1/, Django simply discards the latter and routes the request to the IndexView.