How to fix dashboard fonts not loading in django-oscar

Refresh

April 2019

Views

36 time

1

The dashboard Navbar fonts in Django-oscar dashboard is missing in the production environment. However, it works in local server localhost:8000. Both local and production static files are hosted on AWS S3 bucket.

I have made the S3 bucket public and the CORS policy as follows:-

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

settings.py

STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
AWS_STORAGE_BUCKET_NAME = 'bucketname'
AWS_ACCESS_KEY_ID = 'accesskeyidexample'
AWS_SECRET_ACCESS_KEY = 'secretkeyidexample'
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME


STATICFILES_LOCATION = 'static'
STATICFILES_STORAGE = 'custom_storages.StaticStorage'
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

MEDIAFILES_LOCATION = 'media'
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'

AWS_S3_REGION_NAME = 'us-west-2'
MEDIA_ROOT = MEDIA_URL
OSCAR_MISSING_IMAGE_URL = MEDIA_URL + 'image_not_found.jpg'

AWS_DEFAULT_ACL = None
OSCAR_USE_LESS = False

Django website is hosted on AWS Lambda using Zappa.

I expect the fonts to be loaded in the production environment as for the local environment.

Browser Sources enter image description here

0 answers