Skip to content
Find file
Pull request Compare This branch is 3 commits ahead of nvie:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



django-gravatar makes it easy to add Gravatar support to your Django application through the addition of a template tag.


This code was taken from, but it was superseded by the package, which provides a way more general approach to avatars in Django (not Gravatar-specific, with local Django caching).

If, however, you want to stick to a Gravatar-only solution, this package may a bit more "lightweight" and easier to start using.

This fork contains fixed hash generation.


To install it, download this repository and execute with root access

python install


To use it with a Django installation, first place 'gravatar' in the INSTALLED_APPS tuple of your file like so:

    # ...

Here is sample usage in a template:

{% load gravatar %}
{% gravatar_for_user request.user 40 g %}

In the previous example, a gravatar will be displayed for the specified user at a size of 40 pixels square with a rating of 'g'. The second and third arguments are optional and if not supplied the gravatar image will be 80 pixels square, the default gravatar image size, and will carry a rating of 'g', the default gravatar rating.

In addition to supplying a user object, you can also provide a username as a string. For instance:

{% gravatar_for_user 'jtauber' %}

Or by email:

{% gravatar_for_email '' %}

It is possible to get the url wrapped in an html img tag:

{% gravatar_img_for_email '' %}
{% gravatar_img_for_user request.user %}
{% gravatar_img_for_user 'jtauber' %}

If you only want the URL and not the full blown ``img`-tag, you can use the following functions:

{% gravatar_for_email '' %}
{% gravatar_for_user request.user %}
{% gravatar_for_user 'jtauber' %}

If you want the gravatar profile in json decoded format, you can use the following functions:

{% gravatar_profile_for_email '' %}
{% gravatar_profile_for_user request.user %}
{% gravatar_profile_for_user 'jtauber' %}

There are a few configuration variables available that you can use in your Django's

Something went wrong with that request. Please try again.