Skip to content
Bernardo Heynemann edited this page Feb 14, 2020 · 4 revisions

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:

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.urls import include, path

urlpatterns = [
    path("", include("libthumbor.django.urls")),
]

That way your project gets the following urls:

Template tag

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