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

1464 questions
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
  • 37,543
  • 21
  • 117
  • 168
23
votes
1 answer

Python bottle module causes "Error: 413 Request Entity Too Large"

Using Python's module bottle, I'm getting HTTP 413 error when posting requests of body size > bottle's internal MEMFILE_MAX constant. Minimal working example is shown below. Server part (server.py): from bottle import * @post('/test') def test(): …
Tregoreg
  • 11,747
  • 12
  • 40
  • 63
23
votes
2 answers

How to get callback when key expires in REDIS

I'm developing application using Bottle. In my registration form, I'm confirming email by mail with a unique key. I'm storing this key in REDIS with expiry of 4 days. If user does not confirm email within 4 days, key gets expired. for this, I want…
Kartik Rokde
  • 3,053
  • 7
  • 24
  • 32
23
votes
4 answers

How to retrieve GET vars in python bottle app

I'm trying to make a simple REST api using the Python bottle app. I'm facing a problem in retrieving the GET variables from the request global object. Any suggestions how to retrieve this from the GET request?
Maanas Royy
  • 1,484
  • 1
  • 15
  • 29
22
votes
4 answers

Bottle Py: Enabling CORS for jQuery AJAX requests

I'm working on a RESTful API of a web service on the Bottle Web Framework and want to access the resources with jQuery AJAX calls. Using a REST client, the resource interfaces work as intended and properly handle GET, POST, ... requests. But when…
Joern
  • 449
  • 1
  • 7
  • 14
21
votes
1 answer

How to upload and save a file using bottle framework

HTML:
Category: Select a file:
William Nakagawa
  • 246
  • 1
  • 2
  • 6
20
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
  • 2,522
  • 2
  • 27
  • 46
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
  • 873
  • 2
  • 8
  • 21
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
  • 7,355
  • 4
  • 19
  • 19
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
  • 731
  • 8
  • 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
3 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
  • 273
  • 1
  • 4
  • 14
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
2 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,192
  • 1
  • 20
  • 37
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
  • 593
  • 2
  • 9
  • 22
1
2
3
97 98