Reputation: 7
I am building a a Practice blog with django, after hosting it on heroku, i discovered that any images i upload using image field or fetch disappear after a while.
Now i started using firebase cloud storage via django-storage gloud backend and it is working fine since then , but when i tried hosting my staticfiles storage from there is get this error
cross origin request blocked the same-origin policy disallows reading the remote resource at?
how do i fix this?
if not DEBUG:
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(
os.path.join(BASE_DIR, 'jojopage-123-firebase-adminsdk-l8qsw-810f7d7c00.json')
)
DEFAULT_FILE_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage'
GS_BUCKET_NAME = 'jojopage-123.appspot.com'
STATICFILES_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'mediafiles')
MEDIA_URL = '/media/'
Upvotes: 1
Views: 418
Reputation: 5651
You have a bunch of options:
The first option is probably the easiest one, you can do it by following a tutorias, for example this one.
Upvotes: 1