Question

Unable to make a post with a short video(60 seconds) in DO app

Hi, there

I have enabled video uploads in my Django social media project. It works fine in my local computer, and when I pushed the refactored code to Digital Ocean app, the video uploads give me a 500 error. It only happens with the video uploads, but when I upload the video from Django admin I don’t get an an error and I can see it in the spaces bucket as well as the browser/template and I can play it.

I suspect error is server side.

Here is my settings.py please check it for me do I need to do something special for the video upload?

There is a lot of commented out code please ignore that:

# MEDIA_URL = '/media/'
# MEDIA_ROOT = os.path.join(BASE_DIR, 'media')


# STATICFILES_DIRS = [os.path.join(BASE_DIR, 'soccerfamly/static')]

# Static files (CSS, JavaScript, images)
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')

# DigitalOcean Spaces configuration for static and media files
AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = 'spportsfamly-images'
AWS_S3_ENDPOINT_URL = 'https://spportsfamly-images.sfo3.digitaloceanspaces.com'
AWS_LOCATION = ''

AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400',
}
AWS_DEFAULT_ACL = 'public-read'
AWS_QUERYSTRING_AUTH = False

# Static files storage configuration
STATIC_URL = f'https://{AWS_S3_ENDPOINT_URL}/{AWS_LOCATION}/'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

# Media files storage configuration
MEDIA_URL = f'https://{AWS_S3_ENDPOINT_URL}/{AWS_LOCATION}/media/'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

# Other settings
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

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.

KFSys
Site Moderator
Site Moderator badge
January 21, 2024

Heya @chrismlalazi,

It’s going to be really hard to tell without actual logs, the logs should provide you with a detailed error.

Check this article here:

https://docs.digitalocean.com/products/app-platform/how-to/view-logs/

Once you know the exact error it should be easier to troubleshoot.

Try DigitalOcean for free

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

Sign up

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