Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Django support

fabiomcosta edited this page · 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.

Settings

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

  • THUMBOR_SECURITY_KEY (defaults to 'my-security-key')
  • THUMBOR_SERVER (defaults to 'http://localhost:8888/')

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:

  • http://localhost:8000/gen_url/?width=200&height=300&image_url=localhost:8000/media/photo.jpg

Template tag

Template tag support is available in the https://github.com/ricobl/django-thumbor lib.

Something went wrong with that request. Please try again.