Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Easy timezones for Django (>=1.11) based on MaxMind GeoIP2.

Project description

Timezones. Yuck.

django-easy-timezones-redux Build Status

Easy IP-based timezones for Django (>=1.11) based on MaxMind GeoIP, with IPv6 support. Updated fork of django-easy-timezones that uses the new version of MaxMind's GeoIP2 database.

Quick start

  1. Install django-easy-timezones-redux

    pip install django-easy-timezones-redux
  2. Add "easy-timezones" to your INSTALLED_APPS setting like this:

  3. Add EasyTimezoneMiddleware to your MIDDLEWARE

  4. Add a path to the MaxMind GeoLite2 cities databases in your settings file:

    GEOIP2_DATABASE = '/path/to/your/geoip/database/GeoLite2-City.mmdb'
  5. Enable localtime in your templates.

    {% load tz %}
        The UTC time is {{ }}
    {% localtime on %}
        The local time is {{ }}
    {% endlocaltime %}
  6. That's it!


You can also use signals to perform actions based on the timezone detection.

  1. To hook into the Timezone detection event to, say, save it to the request's user somewhere more permanent than a session, do something like this:

    from easy_timezones.signals import detected_timezone	
    @receiver(detected_timezone, sender=MyUserModel)
    def process_timezone(sender, instance, timezone, **kwargs):
    	if instance.timezone != timezone:
        	instance.timezone = timezone

Project details

Download files

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

Files for django-easy-timezones-redux, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size django_easy_timezones_redux-1.0.4-py3-none-any.whl (11.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-easy-timezones-redux-1.0.4.tar.gz (9.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page