[PYTHON] I want to use the Django Debug Toolbar in my Ajax application

Recent service configuration

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.

Django Debug Toolbar is inconvenient

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.

Have the API form screen automatically generated by REST Framework

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.

Use Swagger for API list & documentation

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!

Find a Django Debug Toolbar that works with Ajax

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

I want to use the Django Debug Toolbar in my Ajax application
I want to use the R dataset in python
I want to pin Datetime.now in Django tests
I want to use the activation function Mish
I want to display the progress in Python!
I want to use complicated four arithmetic operations in the IF statement of the Django template! β†’ Use a custom template
I want to use Python in the environment of pyenv + pipenv on Windows 10
I want to scroll the Django shift table, but ...
I want to write in Python! (3) Utilize the mock
I want to use the latest gcc without sudo privileges! !!
I want to use only the normalization process of SudachiPy
[Python] I want to use the -h option with argparse
[Django] I want to log in automatically after new registration
I can't log in to the admin page with Django3
I want to make the Dictionary type in the List unique
I want to align the significant figures in the Numpy array
I didn't want to write the AWS key in the program
I want to debug with Python
[Linux] I want to know the date when the user logged in
LINEbot development, I want to check the operation in the local environment
I want to make the second line the column name in pandas
I want to pass the G test in one month Day 1
I want to check the position of my face with OpenCV!
I want to know the population of each country in the world.
I compared while reading the documentation to use Jinja2 with Django
[Django] Carefully explain the escape route if you really want to use the table of another application
I want to pin Spyder to the taskbar
I want to output to the console coolly
I want to print in a comprehension
I want to handle the rhyme part1
I want to handle the rhyme part3
I want to use jar from python
I want to use Linux on mac
I want to use IPython Qt Console
I want to display the progress bar
I want to embed Matplotlib in PySimpleGUI
I want to handle the rhyme part2
I want to handle the rhyme part5
I want to handle the rhyme part4
"CSI" that I want to teach beginners in interactive console application production
[C language] I want to generate random numbers in the specified range
I want to batch convert the result of "string" .split () in Python
I want to explain the abstract class (ABCmeta) of Python in detail.
I want to sort a list in the order of other lists
I want to express my feelings with the lyrics of Mr. Children
I want to use the Qore SDK to predict the success of NBA players
I want to leave an arbitrary command in the command history of Shell
Let's use the NAOqi OS VM. I want to resolve dependencies with pip even in Pepper development
I want to use Ubuntu's desktop environment on Android for the time being (Termux version-Japanese input in desktop environment)
I want to visualize where and how many people are in the factory
How to use the C library in Python
I want to do Dunnett's test in Python
I want to have recursion come to my mind
[Python] I want to know the variables in the function when an error occurs!
I want to create an API that returns a model with a recursive relationship in the Django REST Framework
I want to use MATLAB feval with python
I want to create a window in Python
I want to handle the rhyme part7 (BOW)
I want to store DB information in list
How to print debug messages to the Django console
I want to use PyTorch to generate something like the lyrics of Japari Park