Bottle is a WSGI micro web-framework for the Python programming language. It is designed to be fast, simple and lightweight, and is distributed as a single file module with no dependencies other than the Python Standard Library. The same module runs with Python 2.7 and 3.x. To install: pip install bottle
Here is what the above code is Doing:
1. It is importing the bottle module.
2. It is creating a Bottle instance.
3. It is creating a route at the root URL (/) and assigning it the index() function.
4. It is running the Bottle instance on port 8080.
The index() function simply returns the string “Hello, world!”.
You can now run the Bottle application by running the following command:
You should see the following output:
Bottle v0.12.13 server starting up (using WSGIRefServer())…
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
You can now access the application at http://localhost:8080/.