Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ip2location/django-ip2location-timezone
A simple Django package that can help you easily display your website visitor the time according to their location.
https://github.com/ip2location/django-ip2location-timezone
django-framework django-ip2location django-packages geolocation ip-geolocation ip2location ip2location-timezone
Last synced: 3 days ago
JSON representation
A simple Django package that can help you easily display your website visitor the time according to their location.
- Host: GitHub
- URL: https://github.com/ip2location/django-ip2location-timezone
- Owner: ip2location
- License: mit
- Created: 2019-07-11T07:13:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T01:16:35.000Z (over 5 years ago)
- Last Synced: 2024-10-12T07:21:24.745Z (about 1 month ago)
- Topics: django-framework, django-ip2location, django-packages, geolocation, ip-geolocation, ip2location, ip2location-timezone
- Language: Python
- Homepage: https://www.ip2location.com
- Size: 4.88 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: ChangeLog
- License: LICENSE.TXT
Awesome Lists containing this project
README
# Django IP2Location Time Zone
Django IP2Location Time Zone package enables you easily display your website visitor the time baased on their geo location derived from the IP address. This package uses **[IP2Location Web Service](https://www.ip2location.com/web-service/ip2location)** for IP lookup and time zone information.
## Requirements
1. Python 2.7 and above.
2. Django 1.11 and above.
3. **[IP2Location Web Service](https://www.ip2location.com/web-service/ip2location)** API Key. You can get a trial API key from [IP2Location.com](https://www.ip2location.com/register?id=1005).## Quick Start
1. Install this package from PyPI:
```bash
pip install django-ip2location-timezone
```
2. Add "*ip2location_timezone*" to your INSTALLED_APPS setting in settings.py:
```python
INSTALLED_APPS = (
...
'ip2location_timezone',
)
```
1. Add "*IP2locationTimezoneMiddleware*" to your MIDDLEWARE_CLASSES in settings.py:
```python
MIDDLEWARE_CLASSES = (
...
'ip2location_timezone.middleware.IP2locationTimezoneMiddleware',
)
```
4. Add your **[IP2Location Web Service](https://www.ip2location.com/web-service/ip2location)** API Key in settings.py:
```python
IP2LOCATION_API_KEY = 'YOUR_API_KEY'
```
5. In your template, add the following code to display the user time zone and current time:
```python
{% load tz %}
{% localtime on %}
{% get_current_timezone as TIME_ZONE %}
Your timezone is {{ TIME_ZONE }}.
It is {% now "DATETIME_FORMAT" %}
{% endlocaltime %}
```## Support
Email: [[email protected]](mailto:[email protected]).
URL: [https://www.ip2location.com](https://www.ip2location.com/)