Django google bucket No 'Access-Control-Allow-Origin'

Hello guys i have a problem. I don’t know how to describe my problem but let me explain my project first. I have a simple project and i’m using google cloud sql for static and media files (And i’ll deploy on google). And before i move my static files to google cloud sql everything was good but now i have this error (30+ error):
(index):1 Access to font at ‘’ from origin ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

And after little bit search i find django-cors-headers and i fallowed what their intrudction said. here’s my settings codes:

STATIC_ROOT = "static/"
MEDIA_ROOT = 'media/'

I hope someone can help me because i don’t even know what cors is.

CORS is Cross-Origin Resource Sharing. It’s a browser protection that prevents websites from accessing files from across different domain names. It’s meant to be a protection to prevent malicious users from doing some sneaky things on the internet.

In this case, I believe the problem is not with your Django configuration. I believe the problem is that you’re site is trying to access files from Google that it doesn’t have permission to do so. With Google fonts, I believe you’re not allowed to access the TTF files directly. Google provides links that you add to your header to get the font you want.

Here’s the code snippet I found on the Google Font sight for Jost 400:

<link rel="preconnect" href="">
<link href="" rel="stylesheet"> 

Here’s the URL I got it from: Google Fonts

I hope that helps!

1 Like

Thank you man some of my errors gone but there are some errors still here for ex:
Access to script at ‘’ from origin ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

The problem you’re showing now is the same exact kind of problem. Your localhost site is trying to access files from You can’t do that because the site is crossing domains, and the browser is telling you that.

It looks like you’re trying to access Django debug toolbar static files. I’d guess that you’re static files are pointing at an incorrect place for local development. Maybe you need to check on STATIC_URL.

1 Like

Thanks man and i think this night will be long for me. And also if someone wants to add something, i’m here to listen