Django:按距离排序,spatialite不加载C扩展

时间:2017-03-30 09:31:55

标签: python django macos geodjango spatialite

我想根据距离过滤结果,所以我使用了GeoDjango并在我的模型中添加了一个字段PointField

from django.contrib.gis.db import models

location = models.PointField(u"longitude/latitude",
                                 geography=True,
                                 blank=True,
                                 null=True)

但是,在尝试启动索引(我的网站)时,我的浏览器中出现此错误

ImproperlyConfigured at /
The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.10.6
Exception Type: ImproperlyConfigured
Exception Value:    
The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.
Exception Location: /Users/mac/ostadienv/lib/python3.5/site packages/django/contrib/gis/db/backends/spatialite/base.py in get_new_connection, line 52
Python Executable:  /Users/mac/ostadienv/bin/python
Python Version: 3.5.0

这在python中:

'The pysqlite library does not support C extension loading. '
django.core.exceptions.ImproperlyConfigured: The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.

我正在研究MAC。

0 个答案:

没有答案