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
```
========================
[![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
Close
Hashes for django_geoip_redirection-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cc434543b5ba4fae6aa21e1f538d27d98dad48ccc10004676e6aba756b297cf |
|
MD5 | 8f460244e24a229a557ec32bed57e859 |
|
BLAKE2b-256 | 6f42e8e4e740a065a52938fb43f2560ff9aab74475b360840dd20d4e88de77ac |