Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #14133 -- Updated Windows installation instructions for…

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

Backport of r15872 from trunk.

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

0 notes on commit 9ccf1d0

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