14👍
Okay figured it out thanks to this post, the pertinent info for me was:
The solution is to manually set GDAL_LIBRARY_PATH (link) and
GEOS_LIBRARY_PATH (link) in settings.py:GDAL_LIBRARY_PATH = '/opt/homebrew/opt/gdal/lib/libgdal.dylib' GEOS_LIBRARY_PATH = '/opt/homebrew/opt/geos/lib/libgeos_c.dylib'
3👍
You need to do:
brew install postgis
After that manually set GDAL_LIBRARY_PATH and GEOS_LIBRARY_PATH in settings.py:
GDAL_LIBRARY_PATH = '/opt/homebrew/opt/gdal/lib/libgdal.dylib'
GEOS_LIBRARY_PATH = '/opt/homebrew/opt/geos/lib/libgeos_c.dylib'
- Django Nested Groups: Groups in Groups
- Django version of flask.jsonify jsonify
- Django Activity Feed (Feedly Integration?)
0👍
Postgres.app
is an application that provides a self-contained PostgreSQL database server for macOS.
The location of GDAL and GEOS library path can vary depending on the version but follows a path like /Applications/Postgres.app/Contents/Versions/xxx/lib
. There xxx
is version of postgres.app like 14, 15 accordingly.
You need to set the path manually in settings.py
like:
GDAL_LIBRARY_PATH = '/Applications/Postgres.app/Contents/Versions/xxx/lib/libgdal.dylib'
GEOS_LIBRARY_PATH = '/Applications/Postgres.app/Contents/Versions/xxx/lib/libgeos_c.dylib'
Replace your version number instead of xxx
for question’s author it would be 14.
Better alternate
MacOS tries to locate GDAL library in standard library paths like /usr/local/lib
, /usr/lib
and locations in DYLD_LIBRARY_PATH
environment variable so if you do not prefer adding extra code in settings.py
you could add following to your .bashrc
or .zshrc
export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/Versions/xxx/lib/
- Enabling Django Admin Filters on Many-to-Many Fields
- How to correctly use auto_created attribute in django?
- Encoding gives "'ascii' codec can't encode character … ordinal not in range(128)"
- Is uwsgi protocol faster than http protocol?