April 2018
Beginner to intermediate
440 pages
11h 36m
English
Using IDLE or another IDE, open settings.py from the chapter12 project folder. Scroll down to the variable called DATABASES. This variable, which is set to a local SQLite database, will be adjusted to the PostgreSQL database with the PostGIS extension.
This is the default:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }}
Change it to the following, substituting the username and password for your PostGIS installation (see Chapter 3, Introduction to Geospatial Databases):
DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'chapter12', 'USER': '{username}', 'PASSWORD': '{password}', 'HOST': '127.0.0.1', 'PORT':'5432' ...