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
13
votes
2 answers

apache2 using python2.7 & I want to use python3.4

I setup my server using python bottle & mod_wsgi my bottle script are all writing by python3.4 but the apache2 server using by default python2.7.6 ? is there a way to make the python3.4 the default python on apache2 I'm stock right now
saudi_Dev
  • 829
  • 2
  • 7
  • 11
13
votes
2 answers

Streaming file upload using bottle (or flask or similar)

I have a REST frontend written using Python/Bottle which handles file uploads, usually large ones. The API is wirtten in such a way that: The client sends PUT with the file as a payload. Among other things, it sends Date and Authorization headers.…
Tomáš Plešek
  • 1,482
  • 2
  • 12
  • 21
12
votes
2 answers

Is it possible to use gzip compression with Server-Sent Events (SSE)?

I would like to know if it is possible to enable gzip compression for Server-Sent Events (SSE ; Content-Type: text/event-stream). It seems it is possible, according to this book: http://chimera.labs.oreilly.com/books/1230000000545/ch16.html But I…
mguijarr
  • 7,641
  • 6
  • 45
  • 72
11
votes
2 answers

VSCode debugger auto attach to subprocess

In the console output below, it clearly say breakpoints won't work in new process. Where is this debugger settings for attaching to sub-process? pydev debugger: starting pydev debugger: New process is launching (breakpoints won't work in the new…
Black Frog
  • 11,595
  • 1
  • 35
  • 66
11
votes
3 answers

Manually stop processes launched by mod_wsgi, and monitor how many processes are running

I know it's not recommended to run a Bottle or Flask app on production with python myapp.py --port=80 because it's a development server only. I think it's not recommended as well to run it with python myapp.py --port=5000 and link it to Apache with:…
Basj
  • 41,386
  • 99
  • 383
  • 673
11
votes
1 answer

TypeError: 'CommandCursor' object has no attribute '__getitem__'

I am getting this TypeError when trying to access Bottle's rest API through Apache server, but it's working properly with Bottle's WSGI server. Mongodb sample data: "_id" : ObjectId("55c4f21782f2811a08b7ddbb"), "TestName" : "TestName1", …
H. U.
  • 627
  • 1
  • 10
  • 25
11
votes
1 answer

Python Bottle and Cache-Control

I have an application with Python Bottle and I want to add Cache-Control in static files. I am new on this so forgive me if I have done something wrong. Here is the function and how I serve static…
Sfinos
  • 279
  • 4
  • 15
11
votes
3 answers

Bottle middleware to catch exceptions of a certain type?

Given this simple Bottle code: def bar(i): if i%2 == 0: return i raise MyError @route('/foo') def foo(): try: return bar() except MyError as e: response.status_code = e.pop('status_code') return…
stackoverflowuser95
  • 1,992
  • 3
  • 20
  • 30
11
votes
3 answers

Python bottle vs uwsgi/bottle vs nginx/uwsgi/bottle

I am developing a Python based application (HTTP -- REST or jsonrpc interface) that will be used in a production automated testing environment. This will connect to a Java client that runs all the test scripts. I.e., no need for human access (except…
BobIsNotMyName
  • 415
  • 4
  • 11
11
votes
4 answers

running Apache + Bottle + Python

I'm trying to run Bottle.py with Apache and mod_wsgi. I'm running it on windows, using a xampp. python v2.7 My Apache config in httpd: ServerName example.com WSGIScriptAlias / C:\xampp\htdocs\GetXPathsProject\app.wsgi …
Or Duan
  • 13,142
  • 6
  • 60
  • 65
10
votes
5 answers

ImportError: No module named bottle

$ sudo pip install bottle Downloading/unpacking bottle Downloading bottle-0.10.7.tar.gz (55Kb): 55Kb downloaded Running setup.py egg_info for package bottle Installing collected packages: bottle Found existing installation: bottle 0.10.7 …
strangeman
  • 519
  • 1
  • 5
  • 19
10
votes
4 answers

What's the best way to disable Jinja2 template caching in bottle.py?

I'm using Jinja2 templates with Bottle.py and Google App Engine's dev_appserver for development. I want the templates to automatically reload on every request (or ideally only when they change), so that I don't have to keep restarting the…
leted
  • 123
  • 1
  • 7
10
votes
2 answers

Bottle-friendly WSGI authentication library/middleware

What I need is a lightweight authentication/ACL library or middleware which is preferably capable of openID (though this is not crucial), and would play nice with bottle framework (i.e, maybe not use exceptions as an internal flow-control…
user234932
10
votes
2 answers

Decorators vs. classes in python web development

I've noticed three main ways Python web frameworks deal request handing: decorators, controller classes with methods for individual requests, and request classes with methods for GET/POST. I'm curious about the virtues of these three approaches.…
Tristan
  • 6,776
  • 5
  • 40
  • 63
10
votes
1 answer

Does bottle handle requests with no concurrency?

At first, I think Bottle will handle requests concurrently, so I wrote test code bellow: import json from bottle import Bottle, run, request, response, get, post import time app = Bottle() NUMBERS = 0 @app.get("/test") def test(): id =…
WKPlus
  • 6,955
  • 2
  • 35
  • 53