How to upload image through Django admin page



  • Avatar

    no need i already solved!! 

    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov


    Thanks for your update, glad you were able to resolve it. I see that you are using the 3rd party library Django Cloudinary Storage. Would you be able to share your solution and what you have modified to make it work in case any other user comes across this post?

    Comment actions Permalink
  • Avatar

    Hi Aleksandar,

    Thank you for your comment. Here are a few steps I did to address the issue:

    1. I traced back the error message and first check the source code of where defines the sign request function as below.

    Nothing was passed as params or options, so obviously cloudinary.config() method does not obtain the api_key.

    def sign_request(params, options):
        api_key = options.get("api_key", cloudinary.config().api_key)
        if not api_key:
            raise ValueError("Must supply api_key")
        api_secret = options.get("api_secret", cloudinary.config().api_secret)
        if not api_secret:
            raise ValueError("Must supply api_secret")

        params = cleanup_params(params)
        params["signature"] = api_sign_request(params, api_secret)
        params["api_key"] = api_key

        return params

    2. Next I trace back to the config() method in file, where defines the Config class used to access the and grab environment API credentials. 

    class Config(BaseConfig):
        def __init__(self):
            self._uri_scheme = URI_SCHEME
            django_settings = import_django_settings()

            if django_settings:


    3. Here the Django settings are imported via import_django_settings function, inside this function, this is how it grabs the settings:

    from django.conf import settings as _django_settings

    if 'CLOUDINARY' in dir(_django_settings):
        return _django_settings.CLOUDINARY
        return None

    4. Then I run the shell in Django and test if I got a 'None' by running this code below, which returns false.

    from django.conf import settings

    'CLOUDINARY' in dir(settings)

    5. So the reason is still in my settings, then I try to add config method directly in file:


    Now when I upload again it works and no more error. The interesting thing is that when I run step 4 I got a false, I added these settings below but it didn't work, still got a false, not sure why. 

    'CLOUD_NAME': 'name',
    'API_KEY': 'key',
    'API_SECRET': 'secret'

    In conclusion, I misunderstood that the Cloudinary storage setting and Cloudinary setting are interchangeable/same, but by checking the source code of how Cloudinary grabs those settings, I realize they are different and need to set the same credentials twice for both of them. A little bit confusing since I thought the Django Cloudinary Storage is a kind of 'official' package.

    Comment actions Permalink
  • Avatar

    Please how were you able to implement that feature? I mean to be able to upload via the admin page.

    I'm experiencing issues trying to do that. I keep getting an Invalid Signature error.

    Comment actions Permalink
  • Avatar

    Hey Michael,


    The Invalid Signature error is thrown when Signed uploads are enabled on an upload preset that is enabled for the upload. 

    Please see our documentation below for additional information on signed/unsigned uploads.


    This can be disabled for the upload method you are using, or alternatively, you can continue utilizing the signed uploads and provide a signature with the request being made. 

    Comment actions Permalink
  • Avatar

    I have read it. I added my cloudinary configurations in my file and still have the same issue.

    Comment actions Permalink

Please sign in to leave a comment.