Django support

fabiomcosta edited this page Dec 17, 2012 · 3 revisions
Clone this wiki locally

Django Support

Django is a very popular web framework in the python development community. Being so, libthumbor will try to support it as much as possible.


In Django settings you can configure the URL for your thumbor server and security key as such:

Generic View - libthumbor.django.views.generate_url

This view returns a thumbor encrypted URL and is a very good fit for client (Javascript) code that needs to create thumbor URLs. It uses the settings above to generate the URLs.

This view only responds to the GET method and takes the same arguments of the generate method (Usage) in the form of the querystring parameters.

URLs file to include

Thumbor also comes with an URL module that you can just include in your django project, like this:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r"^gen_url/", include('libthumbor.django.urls')),

That way your project gets the following urls:

Template tag

Template tag support is available in the lib.