[Python] Cloudinary Upload Issue on PythonAnywhere: MaxRetryError

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing a Django application that uses Cloudinary for image storage. When running the project locally, everything works fine, and images upload successfully.

    However, when I deploy the project on PythonAnywhere, I get the following error when trying to upload an image from the admin panel:

    Unexpected error - MaxRetryError("TCPKeepAliveHTTPSConnectionPool(host='api.cloudinary.com', port=443): Max retries exceeded with url: /v1_1/di6geozk1/image/upload (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x748d7df0b520>: Failed to establish a new connection: [Errno 111] Connection refused'))")

    Configuration in settings.py:


    CLOUDINARY_STORAGE = {
    'CLOUD_NAME': env('CLOUDINARY_STORAGE_CLOUD_NAME', default=''),
    'API_KEY': env('CLOUDINARY_STORAGE_API_KEY', default=''),
    'API_SECRET': env('CLOUDINARY_STORAGE_API_SECRET', default=''),
    'SECURE': True,
    'API_PROXY': 'http://proxy.server:3128'
    }


    ### Things I've already checked:
    - The credentials (CLOUD_NAME, API_KEY, API_SECRET) are correctly set.
    - In my local environment, images upload successfully to Cloudinary.
    - In PythonAnywhere, the connection is refused.
    - I tried removing the 'API_PROXY' setting, but the error persists.

    Continue reading...

Compartilhe esta Página