Reputation: 79
I have an application built on Django. Initially, I constructed a few APIs using the Django REST API framework, which worked fine. Later, I implemented web sockets to listen to a server. I started the application server on port 5010 and the socket on which this application listens to the server is 8010. However, after implementing web sockets, my API calls started to fail(screenshot below).
Observation: I noticed that the API call doesn't fail after POST operation. The failure is at the point where I access the API at http://127.0.0.1:5010/subscribe/. That is, when I go to http://127.0.0.1:5010/subscribe/ in my browser, that is when I see the failure as shown in the above picture.
If I access the API http://127.0.0.1:5010/subscribe/ by deleting the code for web sockets, the API call works fine (screenshot below)
Please explain if using both REST API framework and web sockets would be possible in Django.
Upvotes: 2
Views: 686
Reputation: 11
I guess you are using the wrong HTTP request in your case.
In Response header, the allowed HTTP request are POST
and OPTIONS
. But you are attempting to make GET
request through web browser.
Try making a POST
request instead.
Upvotes: 1