Database Reference
In-Depth Information
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.gis',
'sightings',
)
7. Now, synchronize the database using the Django syncdb management
command, using the following command; when prompted to create a su-
peruser , answer yes and choose a preferred administrative username and
password:
(chp09-env)$ python manage.py syncdb
8. Now,youwilladdthemodelsneededbytheapplication.Editthe models.py
file under chp09/wildlife/sightings and add the following code:
from django.db import models
from django.contrib.gis.db import models
as gismodels
class Country(gismodels.Model):
"""
Model to represent countries.
"""
isocode =
gismodels.CharField(max_length=2)
name =
gismodels.CharField(max_length=255)
geometry =
gismodels.MultiPolygonField(srid=4326)
objects = gismodels.GeoManager()
Search WWH ::




Custom Search