Skip to main content

GeoIP based redirection middleware

Project description

Django GeoIP Redirection
========================

[![Build Status](https://travis-ci.org/vinitkumar/django_geoip_redirection.svg?branch=feature/add-plugin-doc)](https://travis-ci.org/vinitkumar/django_geoip_redirection)

[![Coverage Status](https://coveralls.io/repos/vinitkumar/django_geoip_redirection/badge.png)](https://coveralls.io/r/vinitkumar/django_geoip_redirection)

It is a GeoIP based redirection middleware that redirects the user on basis of
geolocation of the user. It uses Maxmind's free version of geoip database.


Using the middleware
====================

In order to use the middleware include it into your middlewares list in the
settings file:

```python
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.common.CommonMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'django_geoip_redirection.middleware.LocationMiddleWare',
)
```
And add the `django_geoip_redirection_` to list of INSTALLED APPS:

```python
INSTALLED_APPS = (
'django_geoip_redirection',
....
)
```

You would also need to place the `GeoIP.dat.dat` present inside the data folder to
your project root directory.




Running the Tests
------------------

You can run the tests with via:

```bash
python setup.py test
make test
make all
python runtests.py
```

Project details


Download files

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

Source Distribution

django_geoip_redirection-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

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