Django S3 Storage

March 2014 ยท 1 minute read

Install:

pip install django-storages==1.1.8
pip install boto==2.24.0

Set Amazon keys:

vi ~/.profile
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""

settings.py

from os import environ

#Add storage to INSTALLED_APPS
INSTALLED_APPS = (
    'storages',
)

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = environ.get('AWS_ACCESS_KEY_ID', '')
AWS_SECRET_ACCESS_KEY = environ.get('AWS_SECRET_ACCESS_KEY', '')
AWS_STORAGE_BUCKET_NAME = 'name_of_bucket'

Ref: how-to-store-your-media-files-in-amazon

lxml

pip install lxml

first install those apps and then reboot your system

sudo apt-get install libxml2 sudo apt-get install libxslt-dev sudo apt-get install python-dev

It is more easy to install python-lxml and enable site-packages

Enable site-packages:

toggleglobalsitepackages

pillow needs: $ sudo apt-get install libjpeg-dev and sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev

async: How Do Python Coroutines Work?

Ref: