Skip to main content

A Django app to serve staticfiles using cloudinary

Project description

django-cloudistatic is a Django app to upload your staticfiles to Cloudinary and serve from there. Cloudinary serves files using CDN, which will reduce the load on django server and pages will load faster.

Quick start

  1. Add “djangocloudistatic” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'djangocloudistatic',
    ]
  2. Declare the following settings variables (you will get them from Cloudinary dashboard)

    CLOUDI_NAME = <Cloud name>
    CLOUDI_API_KEY = <API Key>
    CLOUDI_API_SECRET = <API Secret>
  3. Include STATICFILES_DIRS and STATIC_ROOT in settings.py file (Should be included before STATIC_URL) of your project. You may refer to https://docs.djangoproject.com/en/3.2/howto/static-files/ for details.

  4. Modify the STATIC_URL like this:

    STATIC_URL=f'https://res.cloudinary.com/{CLOUDI_NAME}/raw/upload/v1/{STATIC_ROOT}/'
  5. Now run python manage.py collectstatic command to collect all staticfiles to STATIC_ROOT of your project.

  6. Finally, run python manage.py cloudistatic to upload staticfiles to Cloudinary. Wait for a few minutes and your staticfiles will be ready to be served from there. If you want to delete your local STATIC_ROOT (staticfiles will not be served from here now) after uploading to cloud, then you should run python manage.py cloudistatic --deletelocal instead of python manage.py cloudistatic.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-cloudistatic-0.1.dev1.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file django-cloudistatic-0.1.dev1.tar.gz.

File metadata

  • Download URL: django-cloudistatic-0.1.dev1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for django-cloudistatic-0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 97b1ab305c106197c502f0834806a284db3b8004641a30829498d3ab5563ee5d
MD5 645768b990b5412963694f3e46bbdf41
BLAKE2b-256 945973f31aba7d30b2e0c292089ab42238ebda8603e761de8556db5966c1c38a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page