bottle

How to stop the Bottle webserver when started from subprocess

Hello all, I would like to embed the great Bottle web framework into a small application (1st target is Windows OS). This app starts the bottle webserver thanks to the subprocess module. import subprocess p = subprocess.Popen('python websrv.py') The bottle app is quite simple @route("/") def index(): return template('index') ru...

Problems with Routing URLs using CGI and Bottle.py

I've been having difficulty getting anything more than a simple index / to return correctly using bottle.py in a CGI environment. When I try to return /hello I get a 404 response. However, if I request /index.py/hello import bottle from bottle import route @route('/') def index(): return 'Index' @route('/hello') def hello(): ...

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. I would like to know if some of you have experience with one of the alternative serv...

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. Are there major advantages or disadvantages to any of these approaches? To fix ideas, her...

bottle framework....

When I run bottle development server, I notice some warning showing up. Can any one figure it out what exactly is the problem? Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner self.run() File "/usr/local/lib/python2.6/dist-packages/bottle-0.8.1-p...

Emailing admin when a 500 error occurs

How can I send an email to admin when a 500 error occurs, in python. The web framework I'm using is 'bottle'. ...

E-mail traceback on errors in Bottle framework

I am using the Bottle framework. I have set the @error decorator so I am able to display my customized error page, and i can also send email if any 500 error occurs, but I need the complete traceback to be sent in the email. Does anyone know how to have the framework include that in the e-mail? ...

how to send variable to javascript?

I am sending a tuple as my variable to javascript. But i could not find a way. I am using bottle framework. ...

Why does my remote MongoDB connection require authentication on every query?

After fighting with different things here and there, I was finally able to get BottlePY running on Apache and run a MongoDB powered site. I am used to running Django apps, so I will be relating to that a bit in my question. The Problem Every time a page is loaded via BottlePY, the connection to the MongoDB database located on MongoHQ.c...

How to send xml/application format in bottle?

If some one come to my url suppose /get it should give back a xml/application format in response in bottle framework. How can i do this? i am using elementree as xml generator. ...

Bottle and Json

How do I go about returning json data from a bottle request handler. I see a dict2json method in the bottle src but I am not sure how to use it. What is in the documentation: @route('/spam') def spam(): return {'status':'online', 'servertime':time.time()} Gives me this when I bring up the page: <html> <head></head> <bod...

can sys.exit() be made to exit bottle framework

I was hoping that putting 'sys.exit(1)' and catching it later like this will work. xml_open() try: run(reloader=True, host='localhost', port=8080) except SystemExit: xml_save() print "Exited ..." Is there any other solution to exit these python micro-frameworks to exit from inside the handlers ? ...

How to handle JSON request in bottle?

Hi, I need to get data from JSON, transfered by ajax from 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 contains some logics to deal with variables in JSON (it is a main procedure of our game engi...