GithubHelp home page GithubHelp logo

Comments (3)

klis87 avatar klis87 commented on May 20, 2024 1

I see your use case now, and, as this will be backward compatible, we can include this in the package.

As I am quite busy recently, so I would really appreciate PR. Please include a test for this case.

from django-cloudinary-storage.

klis87 avatar klis87 commented on May 20, 2024

Why do you need this? Cloudinary storage is just a custom Django storage implementation, which can be used for both static and media files. The default Django storages use MEDIA_URL and STATIC_URL settings, and in my opinion there is no need to introduce dedicated prefix settings for CLOUDINARY_STORAGE, as it would cause a following problems:

  • unnecessary API pollution
  • making CLOUDINARY_STORAGE less portable - the less work needs to be done when changing storages, the better

from django-cloudinary-storage.

seroy avatar seroy commented on May 20, 2024

I have

DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
MEDIA_URL = '/uploaded/'

but for some models/fields used cloudinary_storage.storage.MediaCloudinaryStorage and ran into side effect that all files uploaded at cloudinary via cloudinary_storage prefixed by '/uploaded/'

Code change is minimal, simple and 100% backward compatible. In app_settings.py add new line:

PREFIX = user_settings.get('PREFIX', settings.MEDIA_URL)

In storage.py change _get_prefix method to:

def _get_prefix(self):
   return app_settings.PREFIX

May be for most cloudinary-storage users it is not principal and they will never change that setting, but it make sense in my case.

from django-cloudinary-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.