Skip to content

Notes about Bottle

Mike Hucka edited this page May 11, 2021 · 1 revision

The definition of the service endpoints and the behaviors is in dibs/server.py. The endpoints are implemented using Bottle.

When running in debug mode, the web server used is the development server provided by Bottle. It has live reload built-in, meaning that changes to the .py files are picked up automatically and the server updates its behavior on the fly. See http://bottlepy.org/docs/dev/tutorial.html#auto-reloading for an important note about Bottle: when it's running in auto-reload mode, "the main process will not start a server, but spawn a new child process using the same command line arguments used to start the main process. All module-level code is executed at least twice". This means some care is needed in how the top-level code is written. Useful to know is that code can distinguish whether it's in the parent or child process by looking for the presence of the environment variable 'BOTTLE_CHILD' set by Bottle in the child process.

Clone this wiki locally