Frequently Asked Questions

About Bottle

Is bottle suitable for complex applications?

Bottle is a micro framework designed for prototyping and building small web applications and services. It stays out of your way and allows you to get things done fast, but misses some advanced features and ready-to-use solutions found in other frameworks (MVC, ORM, form validation, scaffolding, XML-RPC). Although it is possible to add these features and build complex applications with Bottle, you should consider using a full-stack Web framework like pylons or paste instead.

Common Problems and Pitfalls

“Template Not Found” in mod_wsgi/mod_python

Bottle searches in ./ and ./views/ for templates. In a mod_python or mod_wsgi environment, the working directory (./) depends on your Apache settings. You should add an absolute path to the template search path:

bottle.TEMPLATE_PATH.insert(0,'/absolut/path/to/templates/')

so bottle searches the right paths.

Dynamic Routes and Slashes

In dynamic route syntax, a placeholder token (:name) matches everything up to the next slash. This equals to [^/]+ in regular expression syntax. To accept slashes too, you have to add a custom regular pattern to the placeholder. An example: /images/:filepath#.*# would match /images/icons/error.png but /images/:filename won’t.