Access to font at ‘https://acsess.sgp1.digitaloceanspaces.com/acsess/plugins/fonts/outline-icons.ttf’ from origin ‘http://localhost:8000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
These are one of the files from collectstatic.
This is the error I get on my spaces account.
I am using Django with Boto3 and django-storages.
How can I get these files to work.
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!
Hi @acsfess,
Django by default does not provide the headers necessary to provide cross origin. The easiest way would be to just use this Django app that handles it for you: https://github.com/ottoyiu/django-cors-headers
You can then set whichever domains you want white listed using the settings
CORS_ORIGIN_WHITELIST = (
'google.com',
'hostname.example.com'
)
to support allowing all, just use the setting… CORS_ORIGIN_ALLOW_ALL = True and then do any filtering of the request in the middleware or in the view.
Regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.