How do i use external file storage for user uploaded files in Django

52 Views Asked by At

I have deployed my django application on vercel and the mysql database is deployed on Clever Cloud. I have used the Clever Cloud File Storage (FS Bucket) service, free tier to store user uploaded files and images but I am not able to make it work

I get the error: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Here is my configuration

DEFAULT_FILE_STORAGE = 'storages.backends.sftpstorage.SFTPStorage'

SFTP_STORAGE_USE_AGENT = False  # Avoid using insecure key agent authentication
SFTP_STORAGE_HOST = 'bucket-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx-fsbucket.services.clever-cloud.com'
SFTP_STORAGE_USERNAME = 'username@bucket_name'  # Use correct IAM user with access

# Retrieve password securely from environment variable (highly recommended)
SFTP_STORAGE_PASSWORD = 'xxxxxxxxxxxx'

MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL = 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-fsbucket.services.clever-cloud.com/portfolio/'

I cant seem to find the issue. I am open to use any other file storage if it's free

0

There are 0 best solutions below