PK rC$ $ django-cumulus-1.0.10/searchindex.jsSearch.setIndex({objects:{},terms:{"default":[0,1],all:[0,1],code:1,cumulus_use_servicenet:1,photo:0,cdn:0,verbos:1,obtain:0,alt_text:0,cf0:0,four:1,cumulus_timeout:1,through:0,file:[0,1],c0000000:0,follow:0,alt:0,ttf:0,us_authurl:0,filefield:0,access:[0,1],style:[0,1],thank:1,img:0,fix:1,configur:1,upload_to:0,except:1,should:0,add:0,version:[0,1],yourstaticcontain:0,about:0,mai:[0,1],folder:0,containerinfo:1,container_cr:0,them:0,ani:0,r12:0,which:1,get:0,python:[0,1],incorpor:1,woff:0,safe:1,pypi:0,none:0,initi:1,repo:[0,1],ssl:1,srsly:1,"new":[0,1],veri:0,affect:1,bit:1,now:0,requir:[0,1],name:0,cloudfilesstorag:[0,1],pre:1,privat:0,template_context_processor:0,relianc:1,nudg:1,changelog:1,list:0,resolv:1,previou:[0,1],containernam:0,provid:0,februari:1,api:0,nose:1,timeout:[0,1],contain:[0,1],small:0,output:[0,1],septemb:1,container_on:0,manag:[0,1],help:0,cloudfil:[0,1],domain:0,set:[0,1],glare:1,map:[0,1],bump:1,revert:1,creation:1,some:0,sync:[0,1],upload:0,staticfiles_storag:0,see:1,"static":[0,1],connect:[0,1],container_info:0,container_nam:0,download:1,use_ssl:[0,1],server:0,webfont:0,out:0,compat:1,project:[0,1],network:0,item:0,yourapikei:0,http:[0,1],invok:0,subclass:1,rackspac:0,delet:[0,1],restructur:1,rel:0,between:0,servicenet:0,"import":0,across:0,integr:1,altern:0,multipl:1,full:0,run:0,kei:0,numer:1,june:1,exampl:[0,1],javascript:0,usag:0,tox:[0,1],container_list:0,sphinx:1,cloudfiles_storag:0,e8yhcr:1,host:0,c3417812:0,januari:1,releas:[0,1],path:0,method:0,rackcdn:0,valu:0,addit:0,box:0,src:0,convert:1,would:0,thread:1,mysit:0,admin:[0,1],region:0,current:0,synchron:0,filter_list:0,base:[0,1],context:[0,1],fals:0,charfield:0,chang:[0,1],com:0,processor:[0,1],origin:0,pleas:0,api_kei:0,firefox:0,extra:0,ttl:0,cloudfilesstaticstorag:[0,1],height:0,header:0,href:0,suppli:0,instal:[0,1],installed_app:0,storag:[0,1],your:0,cloud:0,backend:1,rackspacecloud:0,fee:0,from:0,second:0,width:0,transfer:0,schenck:1,two:0,empti:0,custom:[0,1],avail:0,few:0,stylesheet:0,max_length:0,includ:0,handl:1,conveni:0,until:0,egg:0,imagefield:0,media:[0,1],properli:1,consol:0,option:0,imag:0,copi:0,imagekit:1,specifi:[0,1],"24h":0,cumulu:0,collectstat:[0,1],link:0,templat:[0,1],intern:0,cname:[0,1],git:0,attribut:1,"true":0,bug:1,content_typ:1,serv:0,pull:1,account:0,container_delet:0,retriev:0,cleanup:1,whether:0,local:0,setup:1,work:[0,1],maximum:0,yourusernam:0,aim:[0,1],directori:1,below:0,can:0,cach:0,report:0,ian:1,root:0,fetch:0,control:0,delete_object:1,want:0,creat:[0,1],stdout:0,site:0,jpg:0,ugli:0,pip:0,tag:1,auth_url:0,expir:0,have:0,need:0,march:1,richleland:0,django:[0,1],whafro:1,develop:0,built:0,perform:0,static_contain:0,make:0,mystaticcontain:0,when:[0,1],note:0,also:0,valid:0,default_file_storag:0,test:[0,1],you:0,tracker:0,config:1,juli:1,css:0,updat:1,cdn_url:0,product:0,finish:0,recogn:0,distribut:[0,1],uk_authurl:0,normal:0,usernam:0,clone:0,after:0,tool:0,express:0,remot:0,attempt:0,regular:0,otf:0,thi:0,remov:1,cumulus_cnam:1,data:0,"class":0,focu:1,util:0,bitbucket:1,github:0,don:0,context_processor:0,url:[0,1],doc:1,gather:0,pseudo:1,uri:1,object:0,exclud:0,issu:[0,1],inform:0,syncstat:[0,1],command:[0,1],allow:0,eot:0,incur:0,model:0,latest:0,physic:1,time:[0,1]},objtypes:{},titles:["django-cumulus","changelog"],objnames:{},filenames:["index","changelog"]})PK rCh_t# # ! django-cumulus-1.0.10/search.html
The aim of django-cumulus is to provide a set of tools to utilize Rackspace Cloud Files through Django. It currently includes a custom file storage class, CloudFilesStorage.
To install the latest release from PyPI using pip:
pip install django-cumulus
To install the development version using pip:
pip install -e git://github.com/richleland/django-cumulus.git#egg=django-cumulus
Add cumulus to INSTALLED_APPS:
INSTALLED_APPS = (
...
'cumulus',
...
)
Add the following to your project’s settings.py file:
CUMULUS = {
'USERNAME': 'YourUsername',
'API_KEY': 'YourAPIKey',
'CONTAINER': 'ContainerName'
}
DEFAULT_FILE_STORAGE = 'cumulus.storage.CloudFilesStorage'
Alternatively, if you don’t want to set the DEFAULT_FILE_STORAGE, you can do the following in your models:
from cumulus.storage import CloudFilesStorage
cloudfiles_storage = CloudFilesStorage()
class Photo(models.Model):
image = models.ImageField(storage=cloudfiles_storage, upload_to='photos')
alt_text = models.CharField(max_length=255)
Then access your files as you normally would through templates:
<img src="{{ photo.image.url }}" alt="{{ photo.alt_text }}" />
Or through Django’s default ImageField or FileField api:
>>> photo = Photo.objects.get(pk=1)
>>> photo.image.width
300
>>> photo.image.height
150
>>> photo.image.url
http://c0000000.cdn.cloudfiles.rackspacecloud.com/photos/some-image.jpg
django-cumulus will work with Django’s built-in collectstatic management command out of the box. You need to supply a few additional settings:
CUMULUS = {
'STATIC_CONTAINER': 'YourStaticContainer'
}
STATICFILES_STORAGE = 'cumulus.storage.CloudFilesStaticStorage'
django-cumulus includes an optional context_processor for accessing the full CDN_URL of any container files from your templates.
This is useful when you’re using Cloud Files to serve you static media such as css and javascript and don’t have access to the ImageField or FileField‘s url() convenience method.
Add cumulus.context_processors.cdn_url to your list of context processors in your project’s settings.py file:
TEMPLATE_CONTEXT_PROCESSORS = (
...
'cumulus.context_processors.cdn_url',
...
)
Now in your templates you can use {{ CDN_URL }} to output the full path to local media:
<link rel="stylesheet" href="{{ CDN_URL }}css/style.css">
This management command synchronizes a local static media folder with a remote container. A few extra settings are required to make use of the command.
Add the following required settings:
CUMULUS = {
'STATIC_CONTAINER': 'MyStaticContainer', # the name of the container to sync with
'SERVICENET': False, # whether to use rackspace's internal private network
'FILTER_LIST': [] # a list of files to exclude from sync
}
Invoke the management command:
django-admin.py syncstatic
You can also perform a test run:
django-admin.py syncstatic -t
For a full list of available options:
django-admin.py help syncstatic
This management command creates a new container in Cloud Files.
Invoke the management command:
django-admin.py container_create <container_name>
For a full list of available options:
django-admin.py help container_create
This management command deletes a container in Cloud Files.
Invoke the management command:
django-admin.py container_delete <container_name>
For a full list of available options:
django-admin.py help container_delete
This management command gathers information about containers in Cloud Files.
Invoke the management command:
django-admin.py container_info [<container_one> <container two> ...]
For a full list of available options:
django-admin.py help container_info
This management command lists all the items in a Cloud Files container to stdout.
Invoke the management command:
django-admin.py container_list <container_name>
For a full list of available options:
django-admin.py help container_list
Below are the default settings:
CUMULUS = {
'API_KEY': None,
'AUTH_URL': 'us_authurl',
'CNAMES': None,
'CONTAINER': None,
'SERVICENET': False,
'TIMEOUT': 5,
'TTL': 86400,
'USE_SSL': False,
'USERNAME': None,
'STATIC_CONTAINER': None,
'FILTER_LIST': []
}
Required. This is your API access key. You can obtain it from the Rackspace Management Console.
Set this to the region your account is in. Valid values are us_authurl (default) and uk_authurl.
A mapping of ugly Rackspace URLs to CNAMEd URLs. Example:
CUMULUS = {
'CNAMES': {
'http://c3417812.r12.cf0.rackcdn.com': 'http://media.mysite.com'
}
}
Required. The name of the container you want files to be uploaded to.
A list of items to exclude when using the syncstatic management command. Defaults to an empty list.
Specifies whether to use Rackspace’s private network (True) or not (False). If you host your sites on Rackspace, you should set this to True in production as you will not incur data transfer fees between your server(s) and Cloud Files on the private network.
When using Django’s collectstatic or django-cumulus’s syncstatic command, this is the name of the container you want static files to be uploaded to.
The timeout to use when attempting connections to Cloud Files. Defaults to 5 (seconds).
The maximum time (in seconds) until a copy of one of your files distributed into the CDN is re-fetched from your container. Defaults to 86400 (seconds) (24h), the default set by python-cloudfiles.
Note: After changing TTL, caching servers may not recognize the new TTL for this container until the previous TTL expires.
Whether or not to retrieve the container URL as http (False) or https (True).
Required. This is your API username. You can obtain it from the Rackspace Management Console.
Set headers based on a regular expression in the file name. This can be used to allow Firefox to access webfonts across domains:
CUMULUS = {
'HEADERS': (
(r'.*\.(eot|otf|woff|ttf)$', {
'Access-Control-Allow-Origin': '*'
}),
)
}
To run the tests, clone the github repo, install tox and invoke tox from the clone’s root. This will upload two very small files to your container and delete them when the tests have finished running.
To report issues, please use the issue tracker at https://github.com/richleland/django-cumulus/issues.