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.

For more info check out the documentation. And for questions about usage or development you can create an issue on Github.

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

Uploaded Source

File details

Details for the file django-cloudistatic-0.0.1.tar.gz.

File metadata

  • Download URL: django-cloudistatic-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 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.0.1.tar.gz
Algorithm Hash digest
SHA256 afb6f426e01ab61f9b61d3517b67234e7509f6727a86f5fa166a1b97a29f0b05
MD5 30e2aa05a36affd0b650b4d5096d16a3
BLAKE2b-256 6d77b3d5372b1098e6dda9d82c49119cfc430b264b6ae6073337fc76e27f1696

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