mysql - Django 1.4.5 - 无法安装 WorldBorder 模型的索引

标签 mysql django geospatial

由于我升级到 Django 1.4.5 并删除并重新创建了 MySQL 5.5.8 数据库,我在 ./managesyncdb 上收到此错误消息

Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Failed to install index for my_app.WorldBorder model: 
   (1464, "The used table type doesn't support SPATIAL indexes")

设置:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',    
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.gis', <---- here
    'pipeline',
    'widget_tweaks',
    'my_app',  
    'south',  
    'modeltranslation',
    'djcelery',
)

但我已经下载并编译了 Geos,到目前为止它一直有效:

wget http://download.osgeo.org/geos/geos-3.3.0.tar.bz2
tar xjf geos-3.3.0.tar.bz2
auto-apt run ./configure
make -j4
sudo checkinstall
sudo ldconfig

我错过了什么吗?

最佳答案

如果数据库类型不是 myisam,创建空间索引会返回错误:

错误 1464 (HY000):使用的表类型不支持 SPATIAL 索引

您可以将数据库类型更改为 myisam,此示例将通过执行以下操作来工作:

alter table geom engine=myisam;

如需引用,请查看此处的文档 http://dev.mysql.com/doc/refman//5.5/en/creating-spatial-indexes.html

关于mysql - Django 1.4.5 - 无法安装 WorldBorder 模型的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15140785/

相关文章:

r - 求R中数据点一定半径内的点数

javascript - PHP - 连接来自 MySQL 的行

php - 通过结果中的引用对 MYSQL 结果进行排序

mysql - 如何在 MySQL 中创建动态数据透视表

python - 运行 django-admin.py startproject 给我一个错误

r - Shiny - FILL 值未在 Shiny 服务器中正确传递给 ggplot - 未找到错误对象 'input'

mysql - 如何选择SQL中的所有字段

python - Django 问题 : UnicodeEncodeError

python - 有没有办法向现有的 django 命令添加功能?