简体   繁体   English

在发动机上使用带有django的GeoIP

[英]using GeoIP with django on appengine

I tried geodjango recently, and worked just fine for me, even without installing that C library. 我最近尝试过geodjango,即使没有安装那个C库也能为我工作。 But when I used the same project in the appengine sdk, it fails whenever it tries to import the GeoIP class then I looked into the differences, I downloaded the new appengine sdk + django 1.2, and the problem remains! 但是当我在appengine sdk中使用相同的项目时,只要它尝试导入GeoIP类就会失败,然后我调查了差异,我下载了新的appengine sdk + django 1.2,问题仍然存在! I tried "python manage.py shell" 我试过“python manage.py shell”

from django.contrib.gis import utils

utils.HAS_GEOIP #returns False(django in appengine)

but when I do the same thing in a native django app the same line returns True what am I missing here? 但是当我在原生django应用程序中执行相同操作时,同一行返回True我在这里缺少什么?

The GeoIP class is a wrapper around the GeoIP C API. GeoIP类是GeoIP C API的包装器。 Unfortunately, you can't use C extensions in appengine, so you can't use the GeoIP support that comes with Django. 不幸的是,你不能在appengine中使用C扩展,所以你不能使用Django附带的GeoIP支持。

pygeoip is a GeoIP library implemented in pure Python, you can try to integrate that. pygeoip是一个用纯Python实现的GeoIP库,你可以尝试集成它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM