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.dev2.tar.gz (4.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: django-cloudistatic-0.1.dev2.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.dev2.tar.gz
Algorithm Hash digest
SHA256 b42282556f671ec43ebb24fa47af320f74b2d369d35d582c1de3c8716b2e7d4e
MD5 e877db70ba5cb966d132b6d893fb2b1f
BLAKE2b-256 186f15bb2e34f9b12b5806214cb607911fe837c7f358d9739a1e0a269780dac3

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