cookiecutter-django icon indicating copy to clipboard operation
cookiecutter-django copied to clipboard

Add Blob Storage as an option for static and media files

Open Jeanluis019 opened this issue 4 years ago • 2 comments

Description

Can I add Blob Storage (Microsoft Azure) as an option to serve static and media files?

Rationale

I always use Amazon S3 for serving static and media files, but now I have a client that has a preference for Blob Storage (Microsoft Azure), so I thought about adding this as an option because it can be helpful for other developers.

Use case(s) / visualization(s)

In my case, I have to use it because a client has a preference for it. But maybe someone feels more comfortable using Azure instead of AWS or Google Cloud.

I can make the PR if you all think it's ok.

Jeanluis019 avatar Nov 05 '19 16:11 Jeanluis019

Not sure how I didn't get around to reply, but yes, this would be a welcomed addition. PR welcome 👍🏻

browniebroke avatar Jan 03 '22 17:01 browniebroke

@Jeanluis019: I know it has been a while but are you still interested in this? We could collaborate on a PR.

I am doing something naive like looking at GCP (for an example) and seeing what could need changing. It doesn't seem like much at all.

$ grep -riI gcp ./*
./config/settings/production.py:GS_BUCKET_NAME = env("DJANGO_GCP_STORAGE_BUCKET_NAME")

$ grep -riI google ./*
./config/settings/production.py:STATICFILES_STORAGE = "project.utils.storages.StaticRootGoogleCloudStorage"
./config/settings/production.py:COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
./config/settings/production.py:STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
./config/settings/production.py:DEFAULT_FILE_STORAGE = "project.utils.storages.MediaRootGoogleCloudStorage"
./config/settings/production.py:MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
./docs/howto.rst:Numpy or Google style docstrings will be picked up from project files and available for documentation. See the `Napoleon <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/>`_ extension for details.
./project/utils/storages.py:from storages.backends.gcloud import GoogleCloudStorage
./project/utils/storages.py:class StaticRootGoogleCloudStorage(GoogleCloudStorage):
./project/utils/storages.py:class MediaRootGoogleCloudStorage(GoogleCloudStorage):
./requirements/production.txt:django-storages[google]==1.12.3  # https://github.com/jschneier/django-storages

hnarayanan avatar Jul 17 '22 16:07 hnarayanan