Admin panel bulk data export

I want to export data from admin panel as my data is containing millions of record. But while exporting I am getting gateway timeout error. For export I am using django-import-export package. How can I optimized the process and export my millions of data. Specifically I need to export in excel sheet.

Note:- I am getting data in panel with other few database tables with different field relations like foreignkey etc.