<commit_before>=============================
dj-libcloud
=============================

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

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.

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.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 <NAME>, Django core developer, the master of Django static asset managment, and a great guy.

TODO
-----

* Tests! OMG TESTS!!!
* More documentation. Especially for provider types.
* 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.

CREDIT
------

Many thanks to <NAME> for giving me the code to get this started.<commit_msg>Update the README<commit_after>=============================
dj-libcloud
=============================

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

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.

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.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 <NAME>, Django core developer, the master of Django static asset managment, and a great guy.

TODO
-----

* Tests! OMG TESTS!!!
* More documentation. Especially for provider types.
* 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.
* Speed it up. Seems to run really slow.

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


CREDIT
------

Many thanks to <NAME> for giving me the code to get this started.
{'fraction_non_alphanumeric': 0.13551064597618187, 'fraction_numerical': 0.005593648502345724, 'mean_word_length': 3.1897203325774752, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3648492', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1557, 'n_words': 643}