Oracle Cloud storage with django

99 views Asked by At

I'm having trouble using oracle object storage as a static file store using django-storages.

# Storage settings
STORAGES = {"staticfiles": {"BACKEND": "storages.backends.s3boto3.S3StaticStorage"}}

ORACLE_BUCKET_NAME = "crescendo-bucket"
ORACLE_NAMESPACE = "ax0elu5q0bbn"
ORACLE_REGION = "us-phoenix-1"

AWS_ACCESS_KEY_ID = "<:)>"
AWS_SECRET_ACCESS_KEY = "<:)>"

AWS_STORAGE_BUCKET_NAME = ORACLE_BUCKET_NAME
AWS_S3_CUSTOM_DOMAIN = (
    f"{ORACLE_NAMESPACE}.compat.objectstorage.{ORACLE_REGION}.oraclecloud.com"
)

AWS_S3_ENDPOINT_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}"
AWS_S3_OBJECT_PARAMETERS = {
    "CacheControl": "max-age=86400",
}
AWS_DEFAULT_ACL = ""
# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{ORACLE_BUCKET_NAME}/"

I have entered this setting and when I enter the `collectstatic` command, I get the error `botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://ax0elu5q0bbn.compat.objectstorage.us-phoenix-1.oraclecloud.com/crescendo-bucket/admin/css/rtl.css"`.

https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm

Cannot set up Oracle bucket for django static files storage

Using this link as a guide, I think I have the right URL configured, but when I make the bucket public and access it as an admin user, the browser still shows a "connection refused" message.

I'm pretty sure I've configured that URL (AWS_S3_ENDPOINT_URL in settings.py) correctly, but it's preventing me from making API calls and accessing the browser. Please let me know what I'm doing wrong.

0

There are 0 answers