I am learning to use the python bottle web framework. I have developed a simple app and I would like to suppress all the requests (urls) output on the terminal (though if there are any error msgs, their output should be ok). I tried setting the DEBUG to False, but that did not make any difference. Is there some other setting for this?
Asked
Active
Viewed 3,092 times
4
-
2Why would you want that? Please don't mistake the Bottle dev server for a production solution. – Helgi Jul 25 '12 at 01:38
-
hmmm... i think u are right. Somehow I wasn't thinking about the fact that when I deploy it into production, I would have to use another webserver. – G.A. Jul 25 '12 at 04:33
2 Answers
7
This works for some servers (including wsgiref):
bottle.run(..., quiet=True)

defnull
- 4,169
- 3
- 24
- 23
-
Thanks. I have accepted this answer since it is the simplest way to do it and works for me. I also realize that I need not be bothered doing this with the development server of bottle. So thanks to others who pointed out that production servers would not give all these url fetch logs (I was concerned that all this printouts would slow down the server). – G.A. Jul 28 '12 at 07:17
4
As mentionned by Helgi, the bottle dev server should'nt be used in production. With most of production server, you will not have these logs.
However, if you want to have a quiet dev server, something like this should work.
import bottle
class QuietWSGIRefServer(bottle.WSGIRefServer):
quiet = True
bottle.run(BOTTLE_APP, server=QuietWSGIRefServer)
I hope it helps

luc
- 41,928
- 25
- 127
- 172