Thursday, January 24, 2013

Re: Problem configuring Django 1.5b2 with PostGIS 2.0

I've been experiencing the same issue on OSX 10.8.2.  

$ ./manage.py shell

ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".

I've installed Postgresapp (http://postgresapp.com/documentation), which includes Postgres 9.2.2, PostGIS 2.0.2, GEOS 3.3.5, and Proj (not sure of the version, but likely recent).  Note: I also got the same error when installing postgres from homebrew.  Various tutorials indicate that I should set the following in settings.py.  (http://wiki.bitnami.org/Components/Django/GoeDjango_with_PostGIS_Quick_Start_Guide)

GDAL_LIBRARY_PATH="/Applications/Postgres.app/Contents/MacOS/lib/libgdal.dylib"
GEOS_LIBRARY_PATH="/Applications/Postgres.app/Contents/MacOS/lib/libgeos_c.dylib"
GDAL_DATA="/Applications/Postgres.app/Contents/MacOS/share/gdal"

Upon doing so, I get a different error.  

OSError: dlopen(/Applications/Postgres.app/Contents/MacOS/lib/libgeos_c.dylib, 6): Library not loaded: @executable_path/../lib/libgeos-3.3.5.dylib
  Referenced from: /Applications/Postgres.app/Contents/MacOS/lib/libgeos_c.dylib
  Reason: image not found

Below is evidence that the files from PATH statements above do exist.  

$ ls -la /Applications/Postgres.app/Contents/MacOS/lib/libgdal.dylib
lrwxr-xr-x@ 1 jjasinski  staff  15 Jan 24 20:56 /Applications/Postgres.app/Contents/MacOS/lib/libgdal.dylib -> libgdal.1.dylib

$ ls -la /Applications/Postgres.app/Contents/MacOS/lib/libgeos_c.dylib
lrwxr-xr-x@ 1 jjasinski  staff  17 Jan 24 20:56 /Applications/Postgres.app/Contents/MacOS/lib/libgeos_c.dylib -> libgeos_c.1.dylib

$ ls -ald /Applications/Postgres.app/Contents/MacOS/share/gdal
drwxr-xr-x@ 47 jjasinski  staff  1598 Jan 24 20:56 /Applications/Postgres.app/Contents/MacOS/share/gdal

My next step is to try to get this running in an Ubuntu virtual machine, but I'd really like to get it work natively in OSX. 


On Friday, December 28, 2012 11:05:57 AM UTC-6, Odagi wrote:
Hi, I have been struggling for two days to get a GeoDjango/PostGIS project started and I'll appreciate any help. Thanks

== My project ==

Two virtual machines: 
   Machine 1: Running Django 1.5b2
   Machine 2: Running a geospatial DB server (postgresql-server-dev-9.1, geos-3.3.5, proj-4.8.0, postgis-2.0.2
 
== My (wrong??) assumption ==

I don't need to install any geos/postgis library on Machine 1. Please let me know if this is incorrect.

== My Problem ==

When I run:
$  manage.py validate

The result is:
ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".

== Tring to fix this ==

In Machine 1 (where I have my Django application), I include this line in settings.py

GEOS_LIBRARY_PATH = '/opt/geos/lib/libgeos_c.so'

But this path is the location of Geos library in Machine 2 (my DB server).
When I run $ manage.py validate, I get this error:

OSError: /opt/geos/lib/libgeos_c.so: cannot open shared object file: No such file or directory

So, may be I need some Geos libraries in Machine 1 in order to Django communicate with PostGIS, but I'm not sure. 
Any ideas? 
 







--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment