In the service I'm making recently
--API server [Django]
Often configured like this, Django is increasingly used as an API server that returns json.
Then, Django Debug Toolbar, which was convenient in Django, doesn't work conveniently. (Django Debug Toolbar is a handy debug tool that lets you know the performance of each API. I'm mainly looking at this because it gives me a history of SQL.)
https://github.com/django-debug-toolbar/django-debug-toolbar
Of course, if you hit the URL of each API, it will work, but since JSON only displays it,
ββIt's hard to understand what View --POST is troublesome --User authentication is troublesome
There is a problem such as.
With the REST Framework, it's not invisible because it provides some looks and useful forms for calling APIs.
http://www.django-rest-framework.org/
However, since there are no screen transitions, you have to remember the API endpoint, which is annoying.
So I'm using django-rest-swagger. It is convenient because you can see all the APIs. Basically, it is often seen in Swagger's UI.
https://github.com/marcgibbons/django-rest-swagger
If you write a comment in the code, you can write a description of the API, so I use it as a substitute for the document. It's also convenient as a mock.
You can also set default values for the form, so you don't have to worry about entering values in the form one by one with the REST Framework.
However, this screen does not work with the Django Debug Toolbar because it calls the API in Ajax. Sorry!
Also, since the recent Web calls API multiple times with Ajax, I would like to know the performance of Django on one screen rather than one API.
And when I was looking for it, I found it!
https://github.com/recamshak/django-debug-panel
A tool is provided by the extension of Chrome, and the history of API called by Ajax is also cached for each page. (See the Chrome store for usage images)
https://chrome.google.com/webstore/detail/django-debug-panel/nbiajhhibgfgkjegbnflpdccejocmbbn
It's convenient! Now you can still benefit from the Django Debug Toolbar even if your API server and web are separate! The best!
Recommended Posts