Skip to main content

A resuable Django application used to display a Flickr badge.

Project description


A resuable [Django]( application to display a [Flickr]( badge.

django-badgr uses the [Flickr API]( to [search]( Flickr and return a user's most recent photos. The results are cached and stored in the Django context. The photo pool is then accessible as a template variable.


* [flickrapi]( is used to interface with the Flickr API.


1. Put the `badgr` directory somewhere inside your Python path (like in your Django project folder).
2. Add `` to your `settings.TEMPLATE_CONTEXT_PROCESSORS`.

A good way to do this with overriding all of Django's default context processors is to first import the variable from the global settings and then append to it:

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS


### Optional

If you want to take advantage of django-badgr's default template, add `badgr` to your `settings.INSTALLED_APPS`.


After installing, the `flickr_badge` variable will be available to all templates. This is a list of dictionaries, each containing all information returned by the Flickr API for each photo. In addition, the URL both to the image itself and to the associated Flickr badge have been prebuilt and are included in the dictionary.

If you have added `badgr` to your `settings.INSTALLED_APPS`, django-badgr's default template will be available for use. This outputs a list of images, each linked to the corresponding Flickr page. To use it, simply include the template in your desired location.

{% include 'badgr/photos.html' %}


django-badgr includes a few settings that you may define in your project's main `settings` file.


The Flickr API key to use. This can be acquired at


The Flickr user ID to use. This is the ugly string on characters, not the pretty name you may have set for your account. If you do not know your user ID, you may find it at


The number of photos to pull. This defaults to 12. Flickr's maximum is 500.


For how long should the photo pool be stored in the cache. This defaults to the [Django cache timeout](, which defaults to 300 seconds (5 minutes). Flickr requests that an application not make more than 3600 requests per API key per hour.


The size of the image you wish to build the URL for. The default is medium (500 on the longest side). Available options are:

* 's': small square 75x75
* 'q': large square 150x150
* 't': thumbnail, 100 on longest side
* 'm': small, 240 on longest side
* 'n': small, 320 on longest side
* '' : medium, 500 on the longest side
* 'z': medium, 640 on longest side
* 'c': medium, 800 on longest side
* 'b': large 1024 on longest side

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-badgr-1.0.tar.gz (4.8 kB view hashes)

Uploaded source

Built Distribution

django_badgr-1.0-py2.7.egg (6.2 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page