Before we get to the action script, we will introduce the concept of storing configuration in one place. This is a useful technique as it allows you to define a dictionary of values that change from site to site. This fosters reusability and makes maintenance easier as all such parameters are in one place. For this purpose, here is the path, /path/to/repo/chapters/06/src/config/config.py, in which a class, Config, is defined. It has a config property and a single method, getConfig():
# config.config
import os
class Config :
config = dict({
'db' : {
'host' : 'localhost',
'port' : 27017,
'database' : 'sweetscomplete'
},
'pagination' : {
'lines' : 4,
'baseUrl' : '/chapter_06/history.py'
},
'session' : {
'storage...