Websites and web applications go through a life-cycle involving development, debugging, staging, and deployment. It is often desirable to alter behavior throughout the application based on the current stage in this life-cycle, for example, to use a different database connection string in deployment than in development or staging.
httpy models this common requirement via a mode singleton, which has the following members:
| ) |
development, debugging, staging, or deployment.
| ) |
development.
httpy's current mode is determined by the environment variable HTTPY_MODE. Since the mode of an application instance is generally only defined at start-up, this API is intended to be read-only. However, mode checks the environment on each call or attribute access, so if you must change the mode on the fly, you can.
Other parts of the httpy package alter their behavior according to the current mode. Here is a reference:
developmentOn Unix systems, the StandAlone coupler monitors the filesystem counterparts of all loaded modules, and restarts itself if the modification time of any of these files changes.
debuggingdevelopment. Additionally, non-Response
Exceptions trigger post-mortem debugging via
pdb.
stagingdeployment.
deployment