skip to navigation
skip to content

django-gravatar2 1.4.2

Essential Gravatar support for Django. Features helper methods, templatetags and a full test suite!

A lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.

If you like this library and it’s saved you some time, please consider supporting further development with a Gittip donation!


  • Helper methods for constructing a gravatar url and checking an email for an existing gravatar
  • Templatetags for generating a gravatar url or gravatar <img> tag.
  • Full test suite!


Install from PyPi:

You can pip install the app directly from GitHub:

$ pip install git+git://

Alternatively, you can now install directly from PyPi!

$ pip install django-gravatar2

Make sure you install django-gravatar2 as there are several other incompatible django-gravatar libraries available.

Add django_gravatar to your INSTALLED_APPS in

    # ...

Basic Usage

Use in code:

from django_gravatar.helpers import get_gravatar_url, has_gravatar, get_gravatar_profile_url, calculate_gravatar_hash

url = get_gravatar_url('', size=150)
gravatar_exists = has_gravatar('')
profile_url = get_gravatar_profile_url('')
email_hash = calculate_gravatar_hash('')

Use in templates:

{% load gravatar %}

{% gravatar_url 150 %}

{% gravatar 150 %}
# <img class="gravatar" src="" width="150" height="150" alt="" />

{% gravatar 150 "" %}
# <img class="gravatar" src="" width="150" height="150" alt="" />

{% gravatar_profile_url %}


The following options can be configured in your

GRAVATAR_URL # Gravatar base url. Defaults to ‘

GRAVATAR_SECURE_URL # Gravatar base secure https url. Defaults to ‘

GRAVATAR_DEFAULT_SIZE # Gravatar size in pixels. Defaults to ‘80’

GRAVATAR_DEFAULT_IMAGE # An image url or one of the following: ‘mm’, ‘identicon’, ‘monsterid’, ‘wavatar’, ‘retro’. Defaults to ‘mm’

GRAVATAR_DEFAULT_RATING # One of the following: ‘g’, ‘pg’, ‘r’, ‘x’. Defaults to ‘g’

GRAVATAR_DEFAULT_SECURE # True to use https by default, False for plain http. Defaults to True


Feel free to fork django-gravatar on GitHub! We’d love to see your pull requests. Please make sure you run tests before submitting a patch.

File Type Py Version Uploaded on Size
django-gravatar2-1.4.2.tar.gz (md5) Source 2017-07-27 6KB
django_gravatar2-1.4.2-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-07-27 9KB