I am new to geodjango, I have the following settings:
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",
)
and I have created the db with following command:
postgres@rewitaqia:~$ createdb -U postgres -T template_postgis -O django dbname
but when I try to sync the db it says:
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?
Also the when I try this in psql it seems that db tas not really created from postgis template:
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.
Thanks for reading anyway.
createdb
'd when you test with psql? Could there be two different ones with different case, or one with and one without an underscore? Connect withpsql
and run\l
. – Craig Ringer