From Dev.to
Exporting Large CSV Files in Django Without Memory Errors
Most CSV exports in Django work great until the table grows. Then the server runs out of memory, because the code builds the entire file before sending it. response = HttpResponse(content_type="text/c...
