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

时间:2021-09-03 03:52:31

I tried geodjango recently, and worked just fine for me, even without installing that C library. 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! I tried "python manage.py shell"

我最近尝试过geodjango,即使没有安装那个C库也能为我工作。但是当我在appengine sdk中使用相同的项目时,只要它尝试导入GeoIP类就会失败,然后我查看了差异,我下载了新的appengine sdk + django 1.2,问题仍然存在!我试过“python manage.py shell”

from django.contrib.gis import utils

来自django.contrib.gis import utils

utils.HAS_GEOIP #returns False(django in appengine)

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我在这里缺少什么?

1 个解决方案

#1


3  

The GeoIP class is a wrapper around the GeoIP C API. Unfortunately, you can't use C extensions in appengine, so you can't use the GeoIP support that comes with Django.

GeoIP类是GeoIP C API的包装器。不幸的是,你不能在appengine中使用C扩展,所以你不能使用Django附带的GeoIP支持。

pygeoip is a GeoIP library implemented in pure Python, you can try to integrate that.

pygeoip是一个用纯Python实现的GeoIP库,你可以尝试集成它。

#1


3  

The GeoIP class is a wrapper around the GeoIP C API. Unfortunately, you can't use C extensions in appengine, so you can't use the GeoIP support that comes with Django.

GeoIP类是GeoIP C API的包装器。不幸的是,你不能在appengine中使用C扩展,所以你不能使用Django附带的GeoIP支持。

pygeoip is a GeoIP library implemented in pure Python, you can try to integrate that.

pygeoip是一个用纯Python实现的GeoIP库,你可以尝试集成它。