I am still new with serving my Django static/media files to Google cloud storage. It's working now but I am not sure if this is right or is this enough already, do I still need to use CDN like Cloudfront or other similar services? I am really confused and any recommendation would be much appreciated.
Below is my configuration.
import os
from google.oauth2 import service_account
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(
os.path.join(BASE_DIR, 'extras/google-storage.json')
)
STATICFILES_STORAGE = 'extras.storage_backends.GoogleCloudStaticFileStorage'
DEFAULT_FILE_STORAGE = 'extras.storage_backends.GoogleCloudMediaFileStorage'
GS_PROJECT_ID = 'project_id'
GS_STATIC_BUCKET_NAME = 'static_bucket'
GS_MEDIA_BUCKET_NAME = 'media_bucket'
STATIC_URL = 'https://storage.googleapis.com/{}/'.format(GS_STATIC_BUCKET_NAME)
MEDIA_URL = 'https://storage.googleapis.com/{}/'.format(GS_MEDIA_BUCKET_NAME)
GS_DEFAULT_ACL = 'publicRead'
I am using the following:
Django 2.2
Python 3.7
Thanks you so much!