V
V
Viktor Yurchenko2019-01-30 15:13:02
Django
Viktor Yurchenko, 2019-01-30 15:13:02

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

3 answer(s)
S
Sergey Tikhonov, 2019-01-30
@tumbler

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)

A
Astrohas, 2019-01-30
@Astrohas

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

Y
Yura Khlyan, 2019-01-30
@MAGistr_MTM

Can you go in shelland do it there?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question