使用 Django GeoIP 数据库作为模型
在我的应用程序中,我使用 django geoIP 来定位用户,它做得很好,但我还需要在我的用户模型中包含位置数据。在我的用户模型中,每个用户都有他们的国家(国籍)、城市(他们所在的位置)和坐标。我认为最好的方法是拥有与适当数据库关联的位置模型(或国家和城市模型)。 现在的问题是,我的模型是否可以使用GeoIP(maxmind GeoLiteCity-GeoIP binary db)使用的数据库?或者我是否需要一个自定义数据库来更好地满足我的目的。我也接受任何更好的方法。
In my App I use django geoIP to locate users and it does its job well, but I also need to include the location data in my users model. In my users model every user will have their country(nationality), city(where they are) and coordinates. I think the best way is to have a location model(or countries and cities model) associated with the appropriate database.
Now the question, is it possible to use the database used by GeoIP(maxmind GeoLiteCity-GeoIP binary db) for my model? or do I need a custom db which serves better my purpose. I also accept any better approach.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您无法为您的模型使用确切的 GEOip 数据库。他们确实提供 CSV 下载,可以轻松填充您的位置模型。
这是其他人基于 geoip 创建的位置模型 http://djangosnippets.org/snippets/327/
I don't think that you can use the exact GEOip database for your model. They do offer a CSV download which could easily populate your location model.
Here is a location model that someone else created based on geoip http://djangosnippets.org/snippets/327/