我正在使用Django 1.2.3,PostGIS 1.5.2.
出于某种原因,当我跑
python manage.py syncdb
它从我的模型创建数据库中的所有其他字段,但避免创建一个我命名为PointField的字段.
在我导入的model.py文件中:
from django.contrib.gis.db import models
并评论说:
#from django.db import models
我的模型看起来像这样:
class MyModel(models.Model): myid = models.AutoField(primary_key=True) title = models.CharField(max_length=50) point = models.PointField() objects = models.GeoManager()
Failed to install index for reports.MyModel model: permission denied for relation spatial_ref_sys CONTEXT: sql statement "SELECT SRID FROM spatial_ref_sys WHERE SRID = new_srid" PL/pgsql function "addgeometrycolumn" line 74 at sql statement sql statement "SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5)" PL/pgsql function "addgeometrycolumn" line 4 at sql statement
在我的setting.py中,我添加了:
DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis',
和
INSTALLED_APPS = ( ... 'django.contrib.gis',...
任何想法为什么我要解决这个问题?谢谢!