Fixed #13267 -- Updated GeoDjango tutorial for the 1.4 release. Thanks samueladam for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ecf75e5957
commit
c8c59c812c
|
@ -100,8 +100,8 @@ the ``geodjango`` project:
|
||||||
Configure ``settings.py``
|
Configure ``settings.py``
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
The ``geodjango`` project settings are stored in the ``settings.py`` file. Edit
|
The ``geodjango`` project settings are stored in the ``geodjango/settings.py``
|
||||||
the database connection settings appropriately::
|
file. Edit the database connection settings appropriately::
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
|
@ -111,10 +111,6 @@ the database connection settings appropriately::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
These database settings are for Django 1.2 and above.
|
|
||||||
|
|
||||||
In addition, modify the :setting:`INSTALLED_APPS` setting to include
|
In addition, modify the :setting:`INSTALLED_APPS` setting to include
|
||||||
:mod:`django.contrib.admin`, :mod:`django.contrib.gis`,
|
:mod:`django.contrib.admin`, :mod:`django.contrib.gis`,
|
||||||
and ``world`` (our newly created application)::
|
and ``world`` (our newly created application)::
|
||||||
|
@ -124,6 +120,8 @@ and ``world`` (our newly created application)::
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.gis',
|
'django.contrib.gis',
|
||||||
'world'
|
'world'
|
||||||
|
@ -362,7 +360,7 @@ tutorial, then we can determine the path using Python's built-in
|
||||||
Now, the world borders shapefile may be opened using GeoDjango's
|
Now, the world borders shapefile may be opened using GeoDjango's
|
||||||
:class:`~django.contrib.gis.gdal.DataSource` interface::
|
:class:`~django.contrib.gis.gdal.DataSource` interface::
|
||||||
|
|
||||||
>>> from django.contrib.gis.gdal import *
|
>>> from django.contrib.gis.gdal import DataSource
|
||||||
>>> ds = DataSource(world_shp)
|
>>> ds = DataSource(world_shp)
|
||||||
>>> print ds
|
>>> print ds
|
||||||
/ ... /geodjango/world/data/TM_WORLD_BORDERS-0.3.shp (ESRI Shapefile)
|
/ ... /geodjango/world/data/TM_WORLD_BORDERS-0.3.shp (ESRI Shapefile)
|
||||||
|
@ -648,7 +646,7 @@ example, the coordinate will be expressed in terms of `EPSG SRID 32140`__,
|
||||||
a coordinate system specific to south Texas **only** and in units of
|
a coordinate system specific to south Texas **only** and in units of
|
||||||
**meters** and not degrees::
|
**meters** and not degrees::
|
||||||
|
|
||||||
>>> from django.contrib.gis.geos import *
|
>>> from django.contrib.gis.geos import Point, GEOSGeometry
|
||||||
>>> pnt = Point(954158.1, 4215137.1, srid=32140)
|
>>> pnt = Point(954158.1, 4215137.1, srid=32140)
|
||||||
|
|
||||||
Note that ``pnt`` may also be constructed with EWKT, an "extended" form of
|
Note that ``pnt`` may also be constructed with EWKT, an "extended" form of
|
||||||
|
@ -729,7 +727,7 @@ Let's dive in again -- create a file called ``admin.py`` inside the
|
||||||
|
|
||||||
admin.site.register(WorldBorder, admin.GeoModelAdmin)
|
admin.site.register(WorldBorder, admin.GeoModelAdmin)
|
||||||
|
|
||||||
Next, edit your ``urls.py`` in the ``geodjango`` project folder to look
|
Next, edit your ``urls.py`` in the ``geodjango`` application folder to look
|
||||||
as follows::
|
as follows::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns, url, include
|
||||||
|
@ -738,7 +736,7 @@ as follows::
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
Start up the Django development server:
|
Start up the Django development server:
|
||||||
|
|
Loading…
Reference in New Issue