I'm using Django 1.2.3, PostGIS 1.5.2.
For some reason when I run
python manage.py syncdb
it's creating all the other fields in the database from my models but avoids creating a field I named point that supposed to be a PointField.
In my model.py files I have imported:
from django.contrib.gis.db import models
and commented:
#from django.db import models
my model looks something like this:
class MyModel(models.Model):
myid = models.AutoField(primary_key=True)
title = models.CharField(max_length=50)
point = models.PointField()
objects = models.GeoManager()
Also when is creating the admin side I get the errors below:
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
In my setting.py I've added:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
and
INSTALLED_APPS = (
...
'django.contrib.gis',
...
Any ides why I'm heaving this issues? Thank you!
The problem was that the PostgreSQL user role django was using had insufficient rights.
What happened when I enabled my database with the PostGIS it created a couple of tables "geometry_columns" and "spatial_ref_sys" using a different user role. So again when Django was trying to access those two tables it chocked because it didn't have enough rights.
It was that simple, whew :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With