Forums

Error code: 504-loadbalancer

I upload a csv file to update my db, and server responded a 504 error, no more error message in log, can anyone tell me what's going on ?

I try on my local server, the update only spent 5 sec, and the function on pythonanythere was work fine a week ago.

A 504 error is a timout -- the request took longer than 5 minutes to process. How big is the CSV? And are you uploading it via the "Files" page inside PythonAnywhere, or via a route in your website's code?

CSV file size is 110k, update or insert 750 rows data, I use django admin to upload file. My problem is the upload file to update DB function was work fine a week ago, spent 1 to 2 minutes and response 200, but now will response 504 timeout, the csv file size always between 100k to 200k, I tried to upload even 1MB csv file was success before.

Which database are you using as your backend? If it's SQLite, that might be the problem -- SQLite is fine when databases are small and have limited concurrent access, but once the DB file passes a certain size (the exact size depends on the structure of the data) it can suddenly start performing significantly worse.

I did use SQLite, but in fact, the upload to update DB was done completed, I did not understand why responesed 504. This days was responsed 200, maybe is the server problem or something like DDoS ?

That sounds like there may be an issue loading the csv into the database. Try adding some logging to the view that is causing the problem and check your server and error logs for clues that might indicate what the issue is.