The web.environment module provides a single function named driver() used to obtain an environment driver to setup or remove an environment.
In the context of a PythonWeb application the environment describes the structures in place in the storage medium and mainly relates to the web.auth and web.session modules.
Environments are best explained by an example. If you are using a database environment it means that you will be storing session and user information in a series of database tables. Before you can start using these tables they need to be created. The web.environment module provides tools to setup the database tables needed. If you were using a file environment, you may need to create the necessary directory structure.
Within an environment, applications can share session and user tables and access each other's information. For example if you had two applications named
news, you might want a user named
james to be able to access both of them without having to sign in to both applications. If the
news applications are both in the same environment this is easy since they both use the same session ID and user information.
Each environment has a name. In the context of a database environment the environment name is simply a string which is used to prepend all the environment tables so that multiple environments (with different names) can exist in the same database. This means that you can run all the PythonWeb environments you want to from the same database which is handy if your shared web hosting agreement only gives you access to one database. In the context of a file environment, the environment name might be the name of the directory holding the data files.