1👍
These are the ways with which you can easily debug in Django :
-
Simple
print
statements while thedjango development server
is running. A simpleprint
statement will output the variable verbatim on yourterminal
. This is the easiest way to get your problem sorted (well, it’s not the ideal way and is only good if you need to debug less often), Sometimes, you would also feel need toprettify
your console output for which you can always useData Pretty Printer
pprint documentation -
Django also leverages
django-debug-toolbar
. According to me, this will qualify as the ideal way to debug Django applications. Here is the documentation for the same. -
Now, since you have DRF already installed and are already working with it, you must be familiar that
django-rest-framework
APIView
is the base class for all theBrowsable APIs
on theDRF Docs
page. You can also visit the API page (URL is configurable) and can simulate API calls from the panel. You can debug through this by returning values that you want to debug asResponse
data for specific API.
- [Answered ]-Are django modules global – ImportError: No module named django.core.management?
- [Answered ]-Adding more associations with foreign key
0👍
Have you tried visiting your API urls in the browser? DRF provides a Browseable API so you can see lists and object details in the browser.
- [Answered ]-Django-filter: add "All" filter option for AllValuesFilter with LinkWidget
- [Answered ]-Environment can only contain strings- wagtail CMS, Django
- [Answered ]-Django Channels: How to flush send buffer