我是geodjango的新手,我有以下设置:
DATABASES = {
"default" : {
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dbname', # Or path to database file if using sqlite3.
'USER': 'django', # Not used with sqlite3.
'PASSWORD': 'somepass', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.gis',
"app.core",
)
我已经使用以下命令创建了数据库:
postgres@rewitaqia:~$ createdb -U postgres -T template_postgis -O django dbname
但是当我尝试同步数据库时,它说:
django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "dbname". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?
另外,当我在 psql 中尝试此操作时,似乎 db 不是真正从 postgis 模板创建的:
db_name=# select postgis_lib_version();
ERROR: no existe la función postgis_lib_version()
ŘÁDKA 1: select postgis_lib_version();
^
DOPORUČENÍ: Ninguna función coincide en el nombre y tipos de argumentos. Puede desear agregar conversión explícita de tipos.
无论如何感谢您的阅读。