Answer the question
In order to leave comments, you need to log in
Error 502 bad gateway in Django admin when deleting items over 100, how to fix?
It is necessary to delete 10 thousand nomenclatures, in total there are 6 million nomenclatures, as I understand it, somewhere in the server settings there is a connection timeout, and you need to increase it, only where to look in the Nginx or django settings?
Answer the question
In order to leave comments, you need to log in
When deleting 10K entries via the admin, Django generates a page listing those entries and any "do you really want to delete this" associated with them. It can take years :)
The solution is to write your own admin action to delete what you need, preferably without using DeleteCollector (it also collects objects in memory before deleting)
Make a custom view / management_command / task / action or whatever you have there and delete elements inside one transaction.
It is advisable to remove cascading children and other related objects first, and then the objects themselves. It is best to delete immediately via queryset.delete().
You can also use raw_delete, but it will be more difficult for you
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question