-
Notifications
You must be signed in to change notification settings - Fork 4
Installation
patrickomatic edited this page Sep 14, 2010
·
22 revisions
- Add
urlimaging
to yourINSTALLED_APPS
insettings.py
like:
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'urlimaging', )
- Add an entry to
urls.py
so that django-url-imaging can listen for image processing commands. Something along the lines of:
urlpatterns = patterns('', ... (r'^images/', include('urlimaging.urls')), ... )
- Configure image storage options for either local storage or storage on Amazon S3.
If you are planning to serve and store images using the local filesystem, you must set the following properties in settings.py
:
-
IMAGE_STORAGE_DIR
– The directory where processed images will be stored. Defaults tosettings.MEDIA_ROOT
When using django-url-imaging with the Amazon S3 service, you must set the following properties in settings.py
-
S3_BUCKET
– The name of the bucket (which should already be created) on S3 where images will be stored.
-
S3_EXPIRES
(optional) – The length of time which the S3-generated URL will be valid.
-
AWS_ACCESS_KEY_ID
– The AWS access key provided by Amazon.
-
AWS_SECRET_ACCESS_KEY
– The AWS secret access key provided by Amazon.
You may also set the following properties in settings.py
-
WHITELIST_FN
– Defines a function which takes one argument – the URL of the current image processing request. The method should returnTrue
orFalse
to either allow the image to be processed or not. If not set it will only allow images to be processed from URLs containingsettings.MEDIA_URL
-
IMAGE_STORAGE_DIRECTORY
– The directory where temporary image files will be created. Defaults to/tmp