Question

Server Error (500) when trying to upload 60 second videos in production-it works only in development

In my Django project deployed as an app in DO I can upload videos in development, but when I fail to do so in DO production which uses Spaces Bucket. I get server error (500).

These are the logs from the app below. Let me also add that while I am in production I can upload the same vide using Django admin without any issues and I can see it in the spaces bucket folder. It is is only when I try to upload from the browser when it fails. I have tried to increase Profile timeout to 5000 seconds from the original 120 seconds and I still get the same error. I also installed FFMpeg and ffmpeg dependencies via VSCODE and App console, and I get the same issue. I need to have video uploads in my app with is a social media app so my users can upload videos(Currently they can only upload images without any problem). So why not video is this something that DO can’t handle? I have tried everything and getting frustrated now as I am paying for this service and it is failing me. I have tried to read everything online and in the community, and still can’t resolve the issue. Kindly help.

sportsfamly] [2024-01-26 18:50:51] [2024-01-26 18:50:51 +0000] [1] [INFO] Starting gunicorn 21.2.0
[sportsfamly] [2024-01-26 18:50:51] [2024-01-26 18:50:51 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[sportsfamly] [2024-01-26 18:50:51] [2024-01-26 18:50:51 +0000] [1] [INFO] Using worker: sync
[sportsfamly] [2024-01-26 18:50:51] [2024-01-26 18:50:51 +0000] [14] [INFO] Booting worker with pid: 14
[sportsfamly] [2024-01-26 18:51:14] 10.244.2.104 - - [26/Jan/2024:18:51:14 +0000] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A307FN) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/23.0 Chrome/115.0.0.0 Mobile Safari/537.36"
[sportsfamly] [2024-01-26 18:51:15] 10.244.2.104 - - [26/Jan/2024:18:51:15 +0000] "GET /login/?next=/ HTTP/1.1" 200 3522 "-" "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A307FN) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/23.0 Chrome/115.0.0.0 Mobile Safari/537.36"
[sportsfamly] [2024-01-26 18:52:35] 10.244.19.241 - - [26/Jan/2024:18:52:35 +0000] "GET / HTTP/1.1" 200 155545 "https://www.sportsfamly.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[sportsfamly] [2024-01-26 18:52:36] 10.244.19.241 - - [26/Jan/2024:18:52:36 +0000] "GET /suggest_users/ HTTP/1.1" 200 2 "https://www.sportsfamly.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[sportsfamly] [2024-01-26 18:52:45] 10.244.19.241 - - [26/Jan/2024:18:52:45 +0000] "POST / HTTP/1.1" 500 145 "https://www.sportsfamly.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 9, 2024

Hi there,

Since you’re encountering a 500 error, the first step should be to check Django’s error logs for specific exceptions or error messages. These logs can provide insight into what is causing the upload to fail. If you’re not seeing detailed errors in your DigitalOcean logs, ensure that your Django settings are configured to log errors appropriately. You might need to adjust the logging level or ensure that DEBUG is set to False in your production settings (which it should be for other reasons as well). Otherwise the generic 500 errors would not really give you any information on what might be going on.

Besides that, just based on the 500 error, one common issue with uploading files in production environments is hitting file size limits set by web servers or application frameworks. Check if there are any file size limits imposed by Gunicorn or Django settings (DATA_UPLOAD_MAX_MEMORY_SIZE and FILE_UPLOAD_MAX_MEMORY_SIZE) that might be lower in production than in your development environment.

Aslo as this works with smaller video files, uploading large files can take significant time, potentially leading to timeouts. Since you mentioned increasing the Profile timeout without success, also review the timeout settings in Gunicorn, e.g., the --timeout flag.

Insufficient resources can lead to process termination or other failures. Is your development environment by any chance with more resources? I think that it might be worth giving it a try to use a larger container and see how it goes.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel