Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14133 -- Updated Windows installation instructions for GeoDjan…

…go, now recommend the OSGeo4W installer for spatial libraries.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c70bdad8b476b457e217c3c444579a8b4b853cc8 1 parent 6091f0e
Justin Bronn authored March 17, 2011
8  docs/ref/contrib/gis/geodjango_setup.bat
... ...
@@ -0,0 +1,8 @@
  1
+set OSGEO4W_ROOT=C:\OSGeo4W
  2
+set PYTHON_ROOT=C:\Python27
  3
+set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal
  4
+set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
  5
+set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin
  6
+reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%"
  7
+reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%"
  8
+reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%"
164  docs/ref/contrib/gis/install.txt
@@ -1093,101 +1093,159 @@ Debian 5.0 . Thus when :ref:`spatialdb_template` either:
1093 1093
 
1094 1094
 .. _windows:
1095 1095
 
1096  
-Windows XP
1097  
-----------
  1096
+Windows
  1097
+-------
  1098
+
  1099
+Proceed through the following sections sequentially in order to install
  1100
+GeoDjango on Windows.
  1101
+
  1102
+.. note::
  1103
+
  1104
+    These instructions assume that you are using 32-bit versions of
  1105
+    all programs.  While 64-bit versions of Python and PostgreSQL 9.0
  1106
+    are available, 64-bit versions of spatial libraries, like
  1107
+    GEOS and GDAL, are not yet provided by the :ref:`OSGeo4W` installer.
1098 1108
 
1099 1109
 Python
1100 1110
 ^^^^^^
1101 1111
 
1102  
-First, download the `Python 2.6 installer`__ from the Python Web site.  Next,
1103  
-execute the installer and use defaults, e.g., keep 'Install for all users'
1104  
-checked and the installation path set as ``C:\Python26``.
  1112
+First, download the latest `Python 2.7 installer`__ from the Python Web site.
  1113
+Next, run the installer and keep the defaults -- for example, keep 
  1114
+'Install for all users' checked and the installation path set as
  1115
+``C:\Python27``.
1105 1116
 
1106 1117
 .. note::
1107 1118
 
1108 1119
     You may already have a version of Python installed in ``C:\python`` as ESRI
1109 1120
     products sometimes install a copy there.  *You should still install a
1110  
-    fresh version of Python 2.6.*
  1121
+    fresh version of Python 2.7.*
1111 1122
 
1112  
-__ http://python.org/ftp/python/2.6.2/python-2.6.2.msi
  1123
+__ http://python.org/download/
1113 1124
 
1114 1125
 PostgreSQL
1115 1126
 ^^^^^^^^^^
1116 1127
 
1117  
-First, select a mirror and download the latest `PostgreSQL 8.3 installer`__ from
1118  
-the EnterpriseDB Web site.
  1128
+First, download the latest `PostgreSQL 9.0 installer`__ from the
  1129
+`EnterpriseDB`__ Web site.  After downloading, simply run the installer,
  1130
+follow the on-screen directions, and keep the default options unless
  1131
+you know the consequences of changing them.
1119 1132
 
1120 1133
 .. note::
1121 1134
 
1122  
-   PostgreSQL 8.3 is required because PostGIS is not available yet for 8.4.
  1135
+    The PostgreSQL installer creates both a new Windows user to be the
  1136
+    'postgres service account' and a ``postgres`` database superuser
  1137
+    You will be prompted once to set the password for both accounts --
  1138
+    make sure to remember it!
1123 1139
 
1124  
-After downloading, simply click on the installer, follow the
1125  
-on-screen directions, and keep the default options (e.g., keep the installation
1126  
-path as ``C:\Program Files\PostgreSQL\8.3``).
  1140
+When the installer completes, it will ask to launch the Application Stack
  1141
+Builder (ASB) on exit -- keep this checked, as it is necessary to
  1142
+install :ref:`postgisasb`.
1127 1143
 
1128 1144
 .. note::
1129 1145
 
1130  
-    This PostgreSQL installation process will create both a new windows user to be the
1131  
-    'postgres service account' and a special 'postgres superuser' to own the database
1132  
-    cluster. You will be prompted to set a password for both users (make sure to write
1133  
-    them down!). To see basic details on the 'service user' account right click on
1134  
-    'My Computer' and select 'Manage' or go to: Control Panel -> Administrative Tools ->
1135  
-    Computer Management -> System Tools -> Local Users and Groups.
  1146
+    If installed successfully, the PostgreSQL server will run in the
  1147
+    background each time the system as started as a Windows service.
  1148
+    A :menuselection:`PostgreSQL 9.0` start menu group will created
  1149
+    and contains shortcuts for the ASB as well as the 'SQL Shell',
  1150
+    which will launch a ``psql`` command window.
1136 1151
 
1137  
-If installed successfully, the PostgreSQL server will run in the background each time
1138  
-the system as started as a Windows service.  When finished, the installer should launch
1139  
-the Application Stack Builder (ASB) -- use this to install PostGIS, see instructions
1140  
-below for more details.  A 'PostgreSQL 8.3' start menu group should be created that
1141  
-contains shortcuts for the ASB and 'Command Prompt', which launches a terminal window
1142  
-in the PostgreSQL directory.
  1152
+__ http://www.enterprisedb.com/products-services-training/pgdownload
  1153
+__ http://www.enterprisedb.com
1143 1154
 
1144  
-__ http://www.enterprisedb.com/products/pgdownload.do#windows
  1155
+.. _postgisasb:
1145 1156
 
1146 1157
 PostGIS
1147 1158
 ^^^^^^^
1148 1159
 
1149  
-From the Application Stack Builder (Programs -> PostgreSQL 8.3), select
1150  
-'PostgreSQL Database Server 8.3 on port 5432' from the drop down menu.  Next,
1151  
-select 'PostGIS 1.3.6 for PostgreSQL 8.3' from the 'Spatial Extensions' tree
1152  
-in the list.  Select only the default options during install (do not uncheck
1153  
-the option to create a default PostGIS database).
  1160
+From within the Application Stack Builder (to run outside of the installer,
  1161
+:menuselection:`Start --> Programs --> PostgreSQL 9.0`), select
  1162
+:menuselection:`PostgreSQL Database Server 9.0 on port 5432` from the drop down
  1163
+menu.  Next, expand the :menuselection:`Categories --> Spatial Extensions` menu
  1164
+tree and select :menuselection:`PostGIS 1.5 for PostgreSQL 9.0`.
  1165
+
  1166
+After clicking next, you will be prompted to select your mirror, PostGIS
  1167
+will be downloaded, and the PostGIS installer will begin.  Select only the
  1168
+default options during install (e.g., do not uncheck the option to create a 
  1169
+default PostGIS database).
1154 1170
 
1155 1171
 .. note::
1156 1172
 
1157  
-    You will be prompted to enter your 'postgres superuser' password in the
1158  
-    'Database Connection Information' dialog.
  1173
+    You will be prompted to enter your ``postgres`` database superuser
  1174
+    password in the 'Database Connection Information' dialog.
1159 1175
 
1160 1176
 psycopg2
1161 1177
 ^^^^^^^^
1162 1178
 
1163 1179
 The ``psycopg2`` Python module provides the interface between Python and the
1164  
-PostgreSQL database.  Download the `Windows installer`__ (v2.0.10) and run
1165  
-using the default settings. [#]_
  1180
+PostgreSQL database.  Download the latest `Windows installer`__ for your version
  1181
+of Python and PostgreSQL and run using the default settings. [#]_
1166 1182
 
1167  
-__ http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.0.10.win32-py2.6-pg8.3.7-release.exe
  1183
+__ http://www.stickpeople.com/projects/python/win-psycopg/
1168 1184
 
1169  
-GeoDjango Installer
1170  
-^^^^^^^^^^^^^^^^^^^
  1185
+.. _osgeo4w:
1171 1186
 
1172  
-Download the `GeoDjango Installer`__; this was created [#]_ to simplify the rest
1173  
-of the process for installing GeoDjango on Windows platforms.  The installer
1174  
-automatically installs Django 1.1, GDAL 1.6.0, PROJ 4.6.1 (including datum grid
1175  
-files), and configures the necessary environment variables.
  1187
+OSGeo4W
  1188
+^^^^^^^
  1189
+
  1190
+The `OSGeo4W installer`_ makes it simple to install the PROJ.4, GDAL, and GEOS
  1191
+libraries required by GeoDjango.  First, download the `OSGeo4W installer`_,
  1192
+and run it.  Select :menuselection:`Express Web-GIS Install` and click next.
  1193
+In the 'Select Packages' list, ensure that GDAL is selected; MapServer and
  1194
+Apache are also enabled by default, but are not required by GeoDjango and
  1195
+may be unchecked safely.  After clicking next, the packages will be
  1196
+automatically downloaded and installed, after which you may exit the
  1197
+installer.
  1198
+
  1199
+.. _OSGeo4W installer: http://trac.osgeo.org/osgeo4w/
  1200
+
  1201
+Modify Windows Environment
  1202
+^^^^^^^^^^^^^^^^^^^^^^^^^^
  1203
+
  1204
+In order to use GeoDjango, you will need to add your Python and OSGeo4W
  1205
+directories to your Windows system ``Path``, as well as create ``GDAL_DATA``
  1206
+and ``PROJ_LIB`` environment variables.  The following set of commands,
  1207
+executable with ``cmd.exe``, will set this up::
  1208
+
  1209
+     set OSGEO4W_ROOT=C:\OSGeo4W
  1210
+     set PYTHON_ROOT=C:\Python27
  1211
+     set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal
  1212
+     set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
  1213
+     set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin
  1214
+     reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%"
  1215
+     reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%"
  1216
+     reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%"
  1217
+
  1218
+For your convenience, these commands are available in the execuatble batch
  1219
+script, :download:`geodjango_setup.bat`.  
  1220
+
  1221
+.. note::
1176 1222
 
1177  
-Once the installer has completed, log out and log back in so that the
1178  
-modifications to the system environment variables take effect, and you
1179  
-should be good to go.
  1223
+    Administrator privileges are required to execute these commands.
  1224
+    To do this, right-click on :download:`geodjango_setup.bat` and select
  1225
+    :menuselection:`Run as administrator`. You need to log out and log back in again
  1226
+    for the settings to take effect.
1180 1227
 
1181 1228
 .. note::
1182 1229
 
1183  
-    The installer modifies the system ``Path`` environment variable to
1184  
-    include ``C:\Program Files\PostgreSQL\8.3\bin`` and
1185  
-    ``C:\Program Files\GeoDjango\bin``.  This is required so that Python
1186  
-    may find the GEOS DLL provided by PostGIS and the GDAL DLL provided
1187  
-    by the installer. The installer also sets the ``GDAL_DATA`` and
1188  
-    ``PROJ_LIB`` environment variables.
  1230
+    If you customized the Python or OSGeo4W installation directories,
  1231
+    then you will need to modify the ``OSGEO4W_ROOT`` and/or ``PYTHON_ROOT``
  1232
+    variables accordingly.
  1233
+
  1234
+Install Django and Setup Database
  1235
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1236
+
  1237
+Finally, :ref:`install Django <installing-official-release>` on your system.
  1238
+You do not need to create a spatial database template, as one named
  1239
+``template_postgis`` is created for you when installing PostGIS.
  1240
+
  1241
+To administer the database, you can either use the pgAdmin III program
  1242
+(:menuselection:`Start --> PostgreSQL 9.0 --> pgAdmin III`) or the
  1243
+SQL Shell (:menuselection:`Start --> PostgreSQL 9.0 --> SQL Shell`).
  1244
+For example, to create a ``geodjango`` spatial database and user, the following
  1245
+may be executed from the SQL Shell as the ``postgres`` user::
1189 1246
 
1190  
-__ http://geodjango.org/windows/GeoDjango_Installer.exe
  1247
+    postgres# CREATE USER geodjango PASSWORD 'my_passwd';
  1248
+    postgres# CREATE DATABASE geodjango OWNER geodjango TEMPLATE template_postgis ENCODING 'utf8';
1191 1249
 
1192 1250
 .. rubric:: Footnotes
1193 1251
 .. [#] The datum shifting files are needed for converting data to and from certain projections.
@@ -1200,5 +1258,3 @@ __ http://geodjango.org/windows/GeoDjango_Installer.exe
1200 1258
        routine from ``ctypes.util`` to locate shared libraries.
1201 1259
 .. [#] The ``psycopg2`` Windows installers are packaged and maintained by
1202 1260
        `Jason Erickson <http://www.stickpeople.com/projects/python/win-psycopg/>`_.
1203  
-.. [#] The source code for the installer is available in the `nsis_installer <http://geodjango.org/hg/nsis_installer/>`_
1204  
-       GeoDjango mercurial repository.

0 notes on commit c70bdad

Please sign in to comment.
Something went wrong with that request. Please try again.