Skip to content

Commit

Permalink
Fix settings import
Browse files Browse the repository at this point in the history
  • Loading branch information
nasief committed May 23, 2018
1 parent 41df618 commit 0dcf9b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions accountsplus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,3 @@ def get_lockout_template():

SUPPORTED_LANGUAGES = get_setting('LANGUAGES', False, DEFAULT_SUPPORTED_LANGUAGES)
DEFAULT_LANGUAGE = get_setting('LANGUAGE_CODE', False, ENGLISH_LANGUAGE)

GEOIP_URL = 'http://freegeoip.net/json'
6 changes: 4 additions & 2 deletions accountsplus/timezone_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import requests
import pytz
from ipware.ip import get_real_ip
from django.conf import settings


GEOIP_URL = 'http://freegeoip.net/json'


def get_user_timezone_from_ip_address(request):
ip = get_real_ip(request)

freegeoip_response = requests.get('{0}/{1}'.format(settings.GEOIP_URL, ip))
freegeoip_response = requests.get('{0}/{1}'.format(GEOIP_URL, ip))
freegeoip_response_json = freegeoip_response.json()
user_time_zone = freegeoip_response_json['time_zone']

Expand Down

0 comments on commit 0dcf9b8

Please sign in to comment.