0
 It's not my answer. Because I am trying to develop in windows 8.1 64bit: http://stackoverflow.com/questions/39037351/django-migration-cant-find-gdalraster

(casino_locater) C:\Users\....\Desktop\Geolocation>python manage.py makemigrations
.............
..............
..............
django.core.exceptions.ImproperlyConfigured: 'django.contrib.gis.db.backends.postgis' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'
Error was: cannot import name 'GDALRaster'

Happy
  • 23
  • 4
  • Possible duplicate of [Django migration can't find GDALRaster](http://stackoverflow.com/questions/39037351/django-migration-cant-find-gdalraster) – Sören Weber Apr 30 '17 at 14:25
  • Welcome to Stackoverflow. Could you be more specific and provide some context about your problem? Telling other members what did you try? What do you want to achieve? And providing and example of them. Check these lins: https://stackoverflow.com/help/mcve , https://stackoverflow.com/help/how-to-ask – Kenzo_Gilead Apr 30 '17 at 14:59
  • Nope, It's not the same. Because I am running in windows machine. – Happy May 01 '17 at 09:47

1 Answers1

1
 
Only for window users: 
Follow the below steps to install gdal into the window environment: 

Step 1: Install OSGeo4W

The OSGeo4W installer makes it simple to install the PROJ.4, GDAL, and GEOS libraries required by GeoDjango. First, download the OSGeo4W installer, and run it. Select Express Web-GIS Install and click next. In the ‘Select Packages’ list, ensure that GDAL is selected; MapServer and Apache are also enabled by default, but are not required by GeoDjango and may be unchecked safely. After clicking next, the packages will be automatically downloaded and installed, after which you may exit the installer.

for 32bit: http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe
for 64bit: http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe

Step 2: Modify Windows environment

In order to use GeoDjango, you will need to add your Python and OSGeo4W directories to your Windows system Path, as well as create GDAL_DATA and PROJ_LIB environment variables. The following set of commands, executable with cmd.exe, will set this up:
`set OSGEO4W_ROOT=C:\OSGeo4W set PYTHON_ROOT=C:\Python27 set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal set PROJ_LIB=%OSGEO4W_ROOT%\share\proj set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%" reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%" reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%" `

Copy (without single inverted commas) the above script into notepad or any text editor and save the file name by geodjango_setup.bat 

Note: 1 

Administrator privileges are required to execute these commands. To do this, right-click on geodjango_setup.bat and select Run as administrator. You need to log out and log back in again for the settings to take effect.

Note: 2

If you customised the Python or OSGeo4W installation directories, then you will need to modify the OSGEO4W_ROOT and/or PYTHON_ROOT variables accordingly. 

For more details : https://docs.djangoproject.com/en/1.10/ref/contrib/gis/install/#windows
Happy
  • 23
  • 4
  • This doesn't work. These are the instructions posted all over other answers and forums, but I still get the following error: "Error was: cannot import name GDALRaster" – coler-j Sep 25 '17 at 18:22