We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 95f0a47 commit 8a17121Copy full SHA for 8a17121
django_traffic/middleware.py
@@ -15,11 +15,12 @@
15
def _load_geo_db():
16
geo_db_path = getattr(settings, 'GEO_DB_PATH', None)
17
if geo_db_path is None:
18
- # assume the user has set GEOIP_PATH in settings.py
19
- g = GeoIP2()
20
- else:
21
- g = GeoIP2(path=geo_db_path)
22
- return g
+ if hasattr(settings, 'GEOIP_PATH'):
+ g = GeoIP2()
+ return g
+ logging.error('[django-traffic] GEOIP_PATH or GEO_DB_PATH should be present in settings.py')
+ return None
23
+ return GeoIP2(path=geo_db_path)
24
25
26
class ESTrafficInfoMiddleware(MiddlewareMixin):
0 commit comments