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
13
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.
  • 210
  • 2
  • 9
12
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
  • 769
  • 1
  • 6
  • 11
12
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,432
  • 2
  • 12
  • 21
11
votes
2 answers

Flask: how to register a wrapper to all methods

I've been moving from bottle to flask. I'm the type of person that prefers writing my own code instead of downloading packages from the internet if I the code needed is 20 lines or less. Take for example support for Basic authentication protocol. In…
nachonachoman
  • 702
  • 1
  • 11
  • 28
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
  • 29,668
  • 65
  • 241
  • 451
11
votes
1 answer

Python thread running twice when called once in main

if __name__ == '__main__': t = threading.Thread(target = authtarget) t.daemon = True t.start() print 'running thread' app.run(debug=True) This main is in our server, where app.run will start the server and will be able to…
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
  • 383
  • 3
  • 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
  • 10,472
  • 3
  • 53
  • 60
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
  • 499
  • 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
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.
  • 597
  • 1
  • 7
  • 24
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,376
  • 4
  • 34
  • 62
10
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
  • 269
  • 4
  • 13
10
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,774
  • 2
  • 18
  • 30
1 2
3
97 98