GeoDjango on Windows: Try setting GDAL_LIBRARY_PATH in your settings
The issue ended up being a version mismatch between Django and GDAL. Django was not searching for the correct file name (gdal202.dll
in my case).
Fixing it required me to add str('gdal202')
to the following file on line 26:
(Python Root)\Lib\site-packages\django\contrib\gis\gdal\libgdal.py
Note that if you are working in a Virtual Environment, then Python Root
will actually be wherever that is ie: Users\YourName\Envs\project
If this issue reoccurs, you can look through your C:\OSGeo4W\bin
directory to figure out which gdalxxx.dll
it is that Django needs to search for.
In addition, make sure that you are using the 32-bit versions of Python and OSGeo4Win. Otherwise, you may see the same failure.
Adding
GDAL_LIBRARY_PATH = r'C:\OSGeo4W64\bin\gdal202'
to the django settings worked for me