Questions tagged [bottle]

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.

Bottle

Bottle is a fast, simple and lightweight micro web-framework for . It is distributed as a single file module and has no dependencies other than the Python Standard Library.

Bottle is designed for prototyping and building small web applications and services. It allows you to get things done quickly, but misses some of the advanced features and ready-to-use solutions found in other frameworks (such as MVC, ORM, form validation, scaffolding and XML-RPC).

Features

  • Routing: Requests to function-call mapping with support for clean and dynamic URLs.
  • Templates: Fast and pythonic built-in template engine and support for mako, jinja2 and cheetah templates.
  • Utilities: Convenient access to form data, file uploads, cookies, headers and other HTTP-related metadata.
  • Server: Built-in HTTP development server and support for paste, fapws3, bjoern, gae, cherrypy or any other WSGI capable HTTP server.

Resources

1487 questions
25
votes
5 answers

Bottle Static files

I have tried reading the docs for Bottle, however, I am still unsure about how static file serving works. I have an index.tpl file, and within it it has a css file attached to it, and it works. However, I was reading that Bottle does not…
IT Ninja
  • 6,174
  • 10
  • 42
  • 65
25
votes
2 answers

Bottle + WebSocket

is it possible to host a normal Bottle application and a WebSocket one (example: https://github.com/defnull/bottle/blob/master/docs/async.rst) in the same application (same port)? So that /ws will go to WebSocket handler and all other will be…
redman
  • 2,115
  • 5
  • 32
  • 59
23
votes
7 answers

Which webserver to use with bottle?

Bottle can use several webservers: Build-in HTTP development server and support for paste, fapws3, flup, cherrypy or any other WSGI capable server. I am using Bottle for a desktop-app and I guess that the development server is enough in this case.…
luc
  • 41,928
  • 25
  • 127
  • 172
22
votes
1 answer

How to upload and save a file using bottle framework

HTML:
Category: Select a file:
William Nakagawa
  • 256
  • 1
  • 2
  • 6
21
votes
2 answers

Reading POST body with bottle.py

I am having trouble reading a POST request with bottle.py. The request sent has some text in its body. You can see how it's made here on line 29: https://github.com/kinetica/tries-on.js/blob/master/lib/game.js. You can also see how it's read on a…
Martín Coll
  • 3,368
  • 3
  • 37
  • 52
20
votes
3 answers

How to add a delay to supervised process in supervisor - linux

I added a bottle server that uses python's cassandra library, but it exits with this error: Bottle FATAL Exited too quickly (process log may have details) log shows this: File "/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py",…
Zack S
  • 1,412
  • 1
  • 23
  • 37
18
votes
2 answers

How do I handle a JSON request in Bottle?

I need to get data from JSON, transferred by Ajax from the client. Basically I used something like this: @route('/ajax') def serve_ajax(): return main.parse_request(json.dumps(dict(request.GET))) Where main.parse_request is a function, that…
kravitz
  • 973
  • 2
  • 10
  • 22
16
votes
4 answers

python bottle always logs to console, no logging to file

In a python project with multiple threads my logging works well to write to a logger file. Basically based on Logging, StreamHandler and standard streams Part of my project is a bottle web server which runs well also. But every bottle call writes a…
gNeandr
  • 381
  • 1
  • 4
  • 14
16
votes
1 answer

TypeError("'bool' object is not iterable",) when trying to return a Boolean

I am having a strange problem. I have a method that returns a boolean. In turn I need the result of that function returned again since I cant directly call the method from the front-end. Here's my code: # this uses bottle py framework and should…
DominicM
  • 6,520
  • 13
  • 39
  • 60
15
votes
4 answers

How do you accept any URL in a Python Bottle server?

Using a Bottle Sehttp://bottlepy.org/docs/dev/routing.html#wildcard-filters I'd like to accept any url, and then do something with the url. e.g. @bottle.route("/") def index(url): return "Your url is " + url This is tricky because URLs…
Dave
  • 9,033
  • 4
  • 21
  • 20
15
votes
3 answers

Bottle.py error routing

Bottle.py ships with an import to handle throwing HTTPErrors and route to a function. Firstly, the documentation claims I can (and so do several examples): from bottle import error @error(500) def custom500(error): return 'my custom…
comamitc
  • 831
  • 1
  • 9
  • 14
15
votes
3 answers

How to load a javascript or css file into a BottlePy template?

I am trying to return a html template with BottlePy. And this works fine. But if I insert a javascript file like this in my tpl-file: I get an 404 error. (Failed to load…
eltorrero
  • 307
  • 1
  • 2
  • 6
15
votes
4 answers

bottle framework with multiple files

I've read the Bottle Documentation but I can't find the example of how to use Bottle with multiple files. Below is the way I did and it's working but I'm not sure whether this is the proper way to go (I saw merge() and mount() in API but not sure if…
user1485873
  • 151
  • 1
  • 3
14
votes
1 answer

How do I access bottle development server from another PC on the LAN?

I'm running the bottle.py tutorial on one PC, and I was able to access it using http://localhost:8080/hello/world However, when I tried to access it (IP address is 192.168.1.10) from another PC on the LAN,…
Ted W.
  • 220
  • 2
  • 9
14
votes
2 answers

Bottle.py HTTP Auth?

How can I get my bottle.py app (Running in Paste or Cherrypy) to do HTTP (basic or digest) authentication? - I need to secure it, but cant find a any HOWTOs.
James Bennet
  • 603
  • 2
  • 10
  • 22