Database Reference
In-Depth Information
as shown in the following code in order to use the postgis_cookbook
PostGIS database for your application data:
DATABASES = {
'default': {
'ENGINE':
'django.contrib.gis.db.backends.postgis',
'NAME': 'postgis_cookbook',
'USER': 'me',
'PASSWORD': 'mypassword',
'HOST': 'localhost',
'PORT': '',
}
}
4. Add the two following lines of code at the top of the wildlife/set-
tings.py file( PROJECT_PATH isthevariableinwhichyouwillsetthepro-
ject's path in the settings menu):
import os
PROJECT_PATH =
os.path.abspath(os.path.dirname(__file__))
5. Make sure that in the settings.py file under chp09/wildlife/wild-
life , MEDIA_ROOT ,and MEDIA_URL arecorrectlyset,asshowninthefol-
lowingcode(thisistosetthemediafiles'pathandURLsfortheimagesthat
the administrative user will upload):
MEDIA_ROOT = os.path.join(PROJECT_PATH,
"media")
MEDIA_URL = '/media/'
6. Makesurethatthe INSTALLED_APPS settinglooksasshowninthefollowing
code in the settings.py file. You will use the Django admin site
(django.contrib.admin),theGeoDjangocorelibrary(django.contrib.gis),and
thesightingsapplicationyouarecreatinginthisrecipeandthenext.Forthis
purpose, add the last three lines:
Search WWH ::




Custom Search