title: GIS/Gdal/OSGeos Import error in django on Windows
body: <p>I am trying this from hours now and I couldn't get get it solved. I am using <a href="https://gis.stackexchange.com/questions/44958/gdal-importerror-in-python-on-windows">this</a> link to setup GeoDjango on Windows. I am getting following error message and I have no clue what to do. All the environment variables are set in Windows and I am able to import with </p>
  
  <blockquote>
    <p>from osgeo import gdal</p>
  </blockquote>
  
  <p>successfully in python terminal as </p>
  
  <blockquote>
    <p>import gdal</p>
  </blockquote>
  
  <p>is deprecated.
  In Postgresql database I have all extensions available as required like <strong>address_standardizer</strong>, <strong>fuzzystrmatch</strong>, <strong>ogr_fdw</strong>, <strong>pgrouting</strong>, <strong>plpgsql</strong>, <strong>pointcloud</strong>, <strong>pointcloud_postgis</strong>, <strong>postgis</strong>, <strong>postgis_sfcgal</strong>, <strong>postgis_tiger_geocoder</strong> and <strong>postgis_topology</strong>.</p>
  
  <p>Django Project Settings:</p>
  
  <pre><code>DATABASES = {
      'default': {
          'ENGINE': 'django.contrib.gis.db.backends.postgis',
          'NAME': 'postgis_24_sample',
          'USER': 'postgres',
          'PASSWORD': 'Hello123',
          'HOST': 'localhost',
          'PORT': '',
      }
  }
  
  GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')
  GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')
  
  INSTALLED_APPS = [
      ...
      'django.contrib.postgis',
      ...
  ]
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>(easy_geodj) C:\Users\dell\Desktop\easy_geodj\easy_geodj\djlocate&gt;python manage.py runserver
  Unhandled exception in thread started by &lt;function wrapper at 0x066D6330&gt;
  Traceback (most recent call last):
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper
      fn(*args, **kwargs)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
      autoreload.raise_last_exception()
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\utils\autoreload.py", line 250, in raise_last_exception
      six.reraise(*_exception)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper
      fn(*args, **kwargs)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\__init__.py", line 27, in setup
      apps.populate(settings.INSTALLED_APPS)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\apps\registry.py", line 108, in populate
      app_config.import_models()
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\apps\config.py", line 202, in import_models
      self.models_module = import_module(models_module_name)
    File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
      __import__(name)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\auth\models.py", line 4, in &lt;module&gt;
      from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\auth\base_user.py", line 52, in &lt;module&gt;
      class AbstractBaseUser(models.Model):
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\models\base.py", line 124, in __new__
      new_class.add_to_class('_meta', Options(meta, app_label))
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\models\base.py", line 330, in add_to_class
      value.contribute_to_class(cls, name)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\models\options.py", line 214, in contribute_to_class
      self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\__init__.py", line 33, in __getattr__
      return getattr(connections[DEFAULT_DB_ALIAS], item)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\utils.py", line 211, in __getitem__
      backend = load_backend(db['ENGINE'])
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\db\utils.py", line 115, in load_backend
      return import_module('%s.base' % backend_name)
    File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
      __import__(name)
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 5, in &lt;module&gt;
      from .features import DatabaseFeatures
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in &lt;module&gt;
      from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 4, in &lt;module&gt;
      from django.contrib.gis.db.models import aggregates
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 3, in &lt;module&gt;
      from django.contrib.gis.db.models.aggregates import *  # NOQA
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\models\aggregates.py", line 1, in &lt;module&gt;
      from django.contrib.gis.db.models.fields import ExtentField
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\db\models\fields.py", line 3, in &lt;module&gt;
      from django.contrib.gis import forms, gdal
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in &lt;module&gt;
      from .fields import (  # NOQA
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\forms\fields.py", line 4, in &lt;module&gt;
      from django.contrib.gis.geos import GEOSException, GEOSGeometry
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\geos\__init__.py", line 5, in &lt;module&gt;
      from .collections import (  # NOQA
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\geos\collections.py", line 11, in &lt;module&gt;
      from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\geos\geometry.py", line 11, in &lt;module&gt;
      from django.contrib.gis import gdal
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 43, in &lt;module&gt;
      from django.contrib.gis.gdal.driver import Driver  # NOQA
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in &lt;module&gt;
      from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in &lt;module&gt;
      from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
    File "C:\Users\dell\Desktop\easy_geodj\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 48, in &lt;module&gt;
      lgdal = CDLL(lib_path)
    File "c:\python27\Lib\ctypes\__init__.py", line 366, in __init__
      self._handle = _dlopen(self._name, mode)
  WindowsError: [Error 126] The specified module could not be found
  </code></pre>