Django app to add a "position" field to the request, using GeoIP or GPS data given in the request headers
Project description
=======================
Django Request Position
=======================
Django app to add a "position" field to the request, using GeoIP or GPS data given in the request headers. Some
references about this:
* `A Uniform Resource Identifier for Geographic Locations ('geo' URI) <http://tools.ietf.org/rfc/rfc5870>`_.
* `HTTP Geolocation draft-thomson-geopriv-http-geolocation-00 <http://tools.ietf.org/html/draft-thomson-geopriv-http-geolocation-00>`_.
Quick start
-----------
**1** Install using pip::
pip install django-belt
**2** Add "request_position" to your INSTALLED_APPS settings like this::
INSTALLED_APPS += ('request_position',)
**3** Add the middleware::
MIDDLEWARE += (
'request_position.middleware.RequestPositionMiddleware',
)
Settings
--------
* ``REQUEST_POSITION_REMOTE_ADDR_ATTR`` (default: "REMOTE_ADDR")
* ``REQUEST_POSITION_DEFAULT_IP`` (default: "127.0.0.1")
* ``REQUEST_POSITION_DEFAULT_POSITION`` (default: None)
* ``REQUEST_POSITION_DEFAULT_COUNTRY_CODE`` (default: None)
* ``REQUEST_POSITION_COOKIE_NAME`` (default: "_request_position")
* ``REQUEST_POSITION_GEO_HEADER`` (default: "HTTP_GEOLOCATION")
* ``REQUEST_POSITION_OVERRIDE_LATITUDE_PARAM`` (default "lat")
* ``REQUEST_POSITION_OVERRIDE_LONGITUDE_PARAM`` (default "lon")
* ``REQUEST_POSITION_OVERRIDE_COUNTRY_CODE_PARAM`` (default "cc")
* ``REQUEST_POSITION_USE_GIS_POINT`` (default False)
History
-------
1.0a12 (2017-12-04)
+++++++++++++++++
* Fixed error wile providing a IP that does not exists.
1.0a7 (2017-12-04)
+++++++++++++++++
* Added ``geoip2`` requirement.
1.0a6 (2017-12-04)
+++++++++++++++++
* Support for Django 2.0.
1.0a5 (2017-2-28)
+++++++++++++++++
* Fixed settings variables prefix.
* Fixed problem with default REQUEST_POSITION_DEFAULT_COUNTRY_CODE value.
* Added settings variables to README.
1.0a4 (2017-2-28)
+++++++++++++++++
* Fixed problem with missing REMOTE_ADDR_ATTR setting variable.
1.0a3 (2017-2-28)
+++++++++++++++++
* Fixed problem with missing header.
1.0a2 (2017-2-28)
+++++++++++++++++
* Fixed Django 1.10 compatibility with new middleware.
1.0a1 (2017-2-21)
+++++++++++++++++
* First release on PyPI.
Django Request Position
=======================
Django app to add a "position" field to the request, using GeoIP or GPS data given in the request headers. Some
references about this:
* `A Uniform Resource Identifier for Geographic Locations ('geo' URI) <http://tools.ietf.org/rfc/rfc5870>`_.
* `HTTP Geolocation draft-thomson-geopriv-http-geolocation-00 <http://tools.ietf.org/html/draft-thomson-geopriv-http-geolocation-00>`_.
Quick start
-----------
**1** Install using pip::
pip install django-belt
**2** Add "request_position" to your INSTALLED_APPS settings like this::
INSTALLED_APPS += ('request_position',)
**3** Add the middleware::
MIDDLEWARE += (
'request_position.middleware.RequestPositionMiddleware',
)
Settings
--------
* ``REQUEST_POSITION_REMOTE_ADDR_ATTR`` (default: "REMOTE_ADDR")
* ``REQUEST_POSITION_DEFAULT_IP`` (default: "127.0.0.1")
* ``REQUEST_POSITION_DEFAULT_POSITION`` (default: None)
* ``REQUEST_POSITION_DEFAULT_COUNTRY_CODE`` (default: None)
* ``REQUEST_POSITION_COOKIE_NAME`` (default: "_request_position")
* ``REQUEST_POSITION_GEO_HEADER`` (default: "HTTP_GEOLOCATION")
* ``REQUEST_POSITION_OVERRIDE_LATITUDE_PARAM`` (default "lat")
* ``REQUEST_POSITION_OVERRIDE_LONGITUDE_PARAM`` (default "lon")
* ``REQUEST_POSITION_OVERRIDE_COUNTRY_CODE_PARAM`` (default "cc")
* ``REQUEST_POSITION_USE_GIS_POINT`` (default False)
History
-------
1.0a12 (2017-12-04)
+++++++++++++++++
* Fixed error wile providing a IP that does not exists.
1.0a7 (2017-12-04)
+++++++++++++++++
* Added ``geoip2`` requirement.
1.0a6 (2017-12-04)
+++++++++++++++++
* Support for Django 2.0.
1.0a5 (2017-2-28)
+++++++++++++++++
* Fixed settings variables prefix.
* Fixed problem with default REQUEST_POSITION_DEFAULT_COUNTRY_CODE value.
* Added settings variables to README.
1.0a4 (2017-2-28)
+++++++++++++++++
* Fixed problem with missing REMOTE_ADDR_ATTR setting variable.
1.0a3 (2017-2-28)
+++++++++++++++++
* Fixed problem with missing header.
1.0a2 (2017-2-28)
+++++++++++++++++
* Fixed Django 1.10 compatibility with new middleware.
1.0a1 (2017-2-21)
+++++++++++++++++
* First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-request-position-1.0a12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d05afe0dbc506448f27697d12d03f13153cf4d98d0222885888822acf3c5085 |
|
MD5 | 2e1963e91a270cb48683358805d3eeb2 |
|
BLAKE2b-256 | b8e9f87ff6b8e7bc41fa3d3d5dce49b5f65ccf4d2df63e32eaa46ab51ed44580 |
Close
Hashes for django_request_position-1.0a12-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 327d8b1f1ef453884c40ee2997c4cb7d679b29df8ce5194d45172253939f3b98 |
|
MD5 | 245eebe94f702154787b2749dadd7ba4 |
|
BLAKE2b-256 | e7c42255ff8ce112b92854c49fbdc927b1758ac3dd11195c04cc9f8481d7ca7b |