Skip to content
PyRax implementation for Django
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src/rax
.gitignore
.travis.yml
CHANGES
Makefile
README.md
setup.py

README.md

django-rax

Build Status

Django-rax is an implementation of pyrax for Django that allows you to synchronize your static files with Rackspace Cloud Files. Also included is an optional storage backend for your media files.

This project is under development and should not be used in a production environment.

Installation

Install via pip:

$ pip install django-rax

Add rax to your INSTALLED_APPS. If you want to use the storage backend for your media files, add this to settings.py:

DEFAULT_FILE_STORAGE = 'rax.storage.RaxStorage'

Configuration

You will need to provide your Rackspace credentials (username, and API key). These can be obtained from the "mycloud" control panel.

RAX = {
  'USERNAME': 'yourusername',
  'API_KEY': 'yourapikey',
  'REGION': 'ORD',
  'CONTAINER': 'yourcontainer'}

"REGION" can be one of ORD, DFW, or LON. If this is not specified, it will default to Chicago (ORD).

Media files are uploaded to the root of your container, and static files will be prefixed by the base name of your STATIC_ROOT setting; for example, if your STATIC_ROOT is /Users/me/myproject/static/, then your static files will be prefixed with 'static/'. That being said, your STATIC/MEDIA URL settings should look something like:

STATIC_URL = 'http://mycdncname.mydomain.com/static/'
MEDIA_URL = 'http://mycdncname.mydomain.com/'

Django Compressor

If you use django-compressor, you will need to turn on the compress offline option to ensure the compressed files are available for syncing.

COMPRESS_OFFLINE = True

Usage

Use the command line to synchronize your static files with Rackspace:

$ python manage.py raxsync

If you use the RaxStorage backend, your media files will be saved both locally and to Rackspace as they are added. If you have existing media files that need to be uploaded, use the management command with the media flag:

$ python manage.py raxsync --media

Help

Email any questions to dustin@dustinfarris.com or report issues on GitHub

Something went wrong with that request. Please try again.