Skip to main content

Adds easy python 3 support to Django for management of static assests (JavaScript, CSS, images, and user uploaded content).

Project description

https://badge.fury.io/py/dj-libcloud.png

Adds easy python 3 support for Django for management of static assests (JavaScript, CSS, images, and user uploaded content.

WARNING: This project is in an ALPHA state. The only testing done so far is me running collectstatic from my local machine and a Heroku app. That works for me, but please don’t count on it working for you. Yet.

Documentation

The full documentation is at https://dj-libcloud.readthedocs.org.

Quickstart

Libcloud verifies server SSL certificates before it lets you do anything. It will search your system for the CA certificate, and if it doesn’t find it then it will blow up. See https://libcloud.readthedocs.org/en/latest/other/ssl-certificate-validation.html

Installing CA certificate bundle on Mac OS X:

# Assuming you are using homebrew for Mac OS X dependency management.
$ brew install curl-ca-bundle

Install dj-libcloud:

$ pip install dj-libcloud

Then use it in a project:

# settings.py

STATIC_URL = 'https://my-assets.cdn/static/'
MEDIA_URL = 'https://my-assets.cdn/media/'
STATICFILES_STORAGE = 'djlibcloud.storage.LibCloudStorage'
LIBCLOUD_PROVIDERS = {
    'amazon_s3': {
        'type': 'libcloud.storage.types.Provider.S3',
        'user': os.environ.get('AWS_ACCESS_KEY'),
        'key': os.environ.get('AWS_SECRET_KEY'),
        'bucket': 'my-assets-cdn',
        'secure': True,
    }
}

DEFAULT_LIBCLOUD_PROVIDER = 'amazon_s3'

Features

  • Works for uploading media assets using Python 3.3 and Django 1.6.

  • In theory supports all the backends that libcloud supports.

FAQ

Because you just had to ask.

Why not use dj-static or whitenoise?

Those are great libraries, but are not what you want when handling user uploaded media.

Why not just update django-storages?

libcloud is awesome and has a dedicated team devoted to it. We can have it do most of the heavy lifting. Heck, converting django-storages to work with Python 3 looked like too much work. Sometimes you just have to start anew, right?

How can I contribute?

Please read http://dj-libcloud.readthedocs.org/en/latest/contributing.html

What about compressors like django-pipeline?

Working on it. Currently the PipelineCachedCloudStorage class breaks the second time you run it. See https://github.com/pydanny/dj-libcloud/issues/7

CREDIT

Many thanks to Jannis Leidel (@jezdez) for giving me the code to get this started. He’s a Django core developer, the master of Django static asset managment, and overall a great great guy.

History

0.1.1 (2014-04-21)

  • Fixed second-time run problem by just using LibCloudStorage class

  • Made django-pipeline optional

  • Removed unnecessary files

  • Moved TODO to issue tracker

0.1.0 (2014-04-21)

  • First release on PyPI.

  • Frustration over lack of easy media asset support for Django and Python 3.

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

dj-libcloud-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file dj-libcloud-0.1.1.tar.gz.

File metadata

  • Download URL: dj-libcloud-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dj-libcloud-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ea341802dd694e348a176eec7b1c58f1bbf83a410da71c96c0baeeeb3b0488b3
MD5 50ce6ae868ce1ee8c77727b9ed5310d7
BLAKE2b-256 9a2e6220d00b4cf7c631be885099d3d54d3be67659660e43a015ffad2b3abc07

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