{ "info": { "author": "Vinit Kumar", "author_email": "vinit.kumar@changer.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![Build Status](https://travis-ci.org/vinitkumar/django-geoip-redirection.svg?branch=master)](https://travis-ci.org/vinitkumar/django-geoip-redirection)\n\nDjango-geoip-redirection\n========================\n\n![World Map](https://i.cloudup.com/7rf2v_IDxv-2000x2000.png)\n\nGeoIP based redirection is awesome and achieving it isn't too hard either. I wrote this middleware \nto ensure that my website would get redirected properly with regards to the location of the user\naccessing the website.\n\n\n## Usage:\n\nAdd the middleware in your settings file:\n\n```python\nMIDDLEWARE_CLASSES = (\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n 'cms.middleware.language.LanguageCookieMiddleware',\n 'django_geoip_redirection.middleware.LocationMiddleWare',\n)\n```\n\nAlso add `django_geoip_redirection` to INSTALLED APPS:\n\n```python\nINSTALLED_APPS = (\n 'django_geoip_redirection',\n ....\n)\n```\n\n## Customization:\n\n```python\n# Change the array for extension as per country you \n# have to support\nif request.path[:4] in [\"/en/\", \"/nl/\", \"/in/\"]:\n return None\n\nif 'HTTP_X_FORWARDED_FOR' in request.META:\n request.META['REMOTE_ADDR'] = request.META['HTTP_X_FORWARDED_FOR']\nip_address = request.META['REMOTE_ADDR']\n# get country name using Maxmind database.\n# Now, just match and redirect.\n# Likewise, replace the name of country to match and redirect.\ncountry = get_country_request(ip_address)\nif country == \"India\":\n return HttpResponseRedirect('/in/')\nelif country == \"Netherlands\":\n return HttpResponseRedirect('/nl/')\nelse:\n return HttpResponseRedirect('/en/')\nreturn None\n\n```\n\nYou would also need to place the `GeoIP.dat.dat` present inside the data folder to\nyour project root directory.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://django_geoip_redirection.rtfd.org/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django_geoip_redirection", "package_url": "https://pypi.org/project/django_geoip_redirection/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django_geoip_redirection/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://django_geoip_redirection.rtfd.org/" }, "release_url": "https://pypi.org/project/django_geoip_redirection/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "GeoIP based redirection middleware", "version": "0.1.3" }, "last_serial": 1148225, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3d3dd70e83e9c2ef51569467e6d4dda7", "sha256": "f594e82d9b843f3258dd3a54d91908e2ce36b78c0c0475b4b87cedb6f19531ef" }, "downloads": -1, "filename": "django_geoip_redirection-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3d3dd70e83e9c2ef51569467e6d4dda7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3817, "upload_time": "2014-04-26T13:04:24", "url": "https://files.pythonhosted.org/packages/ff/c4/7de3772170b950ae8dbc9c2d6a56afc059e27a8f871f10142be0e6f71bda/django_geoip_redirection-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8f460244e24a229a557ec32bed57e859", "sha256": "4cc434543b5ba4fae6aa21e1f538d27d98dad48ccc10004676e6aba756b297cf" }, "downloads": -1, "filename": "django_geoip_redirection-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8f460244e24a229a557ec32bed57e859", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3827, "upload_time": "2014-04-26T13:13:34", "url": "https://files.pythonhosted.org/packages/6f/42/e8e4e740a065a52938fb43f2560ff9aab74475b360840dd20d4e88de77ac/django_geoip_redirection-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7abd37bee02dad0bb7227d5e0a3768cd", "sha256": "acd17c287c7f704f04b891e7c038ea02e9358b77cff9ad3c8537ff591d32da9f" }, "downloads": -1, "filename": "django_geoip_redirection-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7abd37bee02dad0bb7227d5e0a3768cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3932, "upload_time": "2014-04-26T13:32:13", "url": "https://files.pythonhosted.org/packages/05/c8/5aa714b461c4b6a14bce34bd6831a5b11755e19f6c63e50cb77cfd5c0cce/django_geoip_redirection-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "77c610f551b2188ac988509d33382928", "sha256": "086ec69621c7f6e014ad5f59b40a288cd2bddcb58ea872fe97ddb97b1b1bbeaf" }, "downloads": -1, "filename": "django_geoip_redirection-0.1.3.tar.gz", "has_sig": false, "md5_digest": "77c610f551b2188ac988509d33382928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3918, "upload_time": "2014-07-05T18:18:35", "url": "https://files.pythonhosted.org/packages/ef/4a/afd7795da44001e9a2242afd030873deb1f8e1f8f89ca06d4c6a8c299996/django_geoip_redirection-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "77c610f551b2188ac988509d33382928", "sha256": "086ec69621c7f6e014ad5f59b40a288cd2bddcb58ea872fe97ddb97b1b1bbeaf" }, "downloads": -1, "filename": "django_geoip_redirection-0.1.3.tar.gz", "has_sig": false, "md5_digest": "77c610f551b2188ac988509d33382928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3918, "upload_time": "2014-07-05T18:18:35", "url": "https://files.pythonhosted.org/packages/ef/4a/afd7795da44001e9a2242afd030873deb1f8e1f8f89ca06d4c6a8c299996/django_geoip_redirection-0.1.3.tar.gz" } ] }