Skip to main content

Adds easy support for libcloud to Django

Project description

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

Adds easy support for libcloud to Django. This allows for handling of media assets for Django and is designed to work easily with Python 3.3+ and Django 1.6+. In the works is support for Python 2.7.

Many thanks go to Jannis Leidel for giving me the code to get this started.

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.PipelineStorage'
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.

  • Code borged from work of Jannis Leidel, Django core developer, the master of Django static asset managment, and a great guy.

TODO

  • Tests! OMG TESTS!!!

  • More documentation. Especially on providers types available.

  • Backport to Python 2.7

  • Add better error message if bucket not found

  • Come up with more storage types so we aren’t dependant on django-pipeline. Nothing wrong with pipeline, just want to provide more options.

History

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for dj-libcloud-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1fc953777efdccc92b6083df90a6eb87900ec8ae7c7984f1af75848019d58b31
MD5 17f33754e66be9a627d1d1d95af9eb41
BLAKE2b-256 7abe0b0a9a7ef604693004c5bc1aec05a58758d6aab2f168c7a1052b5f181b83

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