Python requests 503 erros when trying to access localhost:8000

后端 未结 2 687
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 05:25

I am facing a bit of a situation,

Scenario: I got a django rest api running on my localhost:8000 and I want to access the api using my command line. I have tried urllib

2条回答
  •  天命终不由人
    2021-01-28 05:32

    If you are registering your serializers with DefaultRouter then your api will appear at

    http://localhost:8000/api/ for an html view of the index
    http://localhost:8000/api/.json for a JSON view of the index
    http://localhost:8000/api/appname for an html view of the individual resource
    http://localhost:8000/api/appname/.json for a JSON view of the individual resource
    

    you can check the response in your browser to make sure your URL is working as you expect.

提交回复
热议问题