APP platform Server Error (500) when reposting post with images

In my django social media websites deployed as a web app, I have a view where user can make reposts of posts from other users. On the local environment(In my laptop); I can successfully repost posts with or with our images. But when I deployed the project into DO App platform where I have a postgress DB and a Spaces bucket for images, when I repost a post without images, it is reposted successfully, but when the post has an images, I get the server error 500 on the browser.

Now the confusing thing is that even if I get the error, when I refresh the browser, I the post with the images would have been reposted.

How can I prevent this error from happening as it is not good for users of the web app to see this - please not that works fine in my local server

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
January 14, 2024
Accepted Answer

Hey Chris,

Typically, a Server Error (500) typically indicates a problem on the server-side, and the fact that it occurs only when reposting posts with images suggests that the issue might be related to how your app handles image uploads in the production environment. Here are some steps to troubleshoot the issue:

  1. Check Your App’s Logs: The first step in diagnosing a 500 error is to look at the logs. DigitalOcean App Platform provides logs for your running apps, which can give you insight into what’s happening when the error occurs. Look for any error messages or stack traces that occur at the time of the error.

  2. File Permissions and Storage Configuration: Since the issue is related to image uploads, check if the file permissions and storage configurations on your DigitalOcean Spaces are correctly set. Ensure that your Django app has the necessary permissions to write to the Spaces bucket.

  3. Django Media Settings: Verify your MEDIA_URL and MEDIA_ROOT settings in Django’s These settings should be configured to correctly point to your DigitalOcean Spaces bucket where the images are stored.

  4. Django Static Files: Ensure that your static files are properly set up. In production, Django does not handle static files the same way it does in development. You need to configure STATIC_URL and STATIC_ROOT appropriately and run python collectstatic to collect static files.

Feel free to share any of the errors here so that I could try and advise you further.



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