November 2014
Intermediate to advanced
258 pages
5h 15m
English
An interesting way of laying out configurations for different deployment modes, such as production, testing, staging, and so on, can be cleanly done using the inheritance pattern of classes. As the project gets bigger, you can have different deployment modes such as development, staging, production, and so on, where each mode can have several different configuration settings, and some settings will remain the same.
We can have a default setting base class, and other classes can inherit this base class and override or add deployment-specific configuration variables.
The following is an example of our default setting base class:
class BaseConfig(object): 'Base config class' SECRET_KEY = 'A random secret key' DEBUG ...
Read now
Unlock full access