Questions tagged [cherrypy]

CherryPy is a pythonic, object-oriented HTTP framework. See cherrypy.dev for more information. Ask for interactive help @ https://gitter.im/cherrypy/cherrypy

CherryPy is a pythonic, object-oriented HTTP framework.

Features

  • A HTTP/1.1-compliant, WSGI thread-pooled webserver. Typically, CherryPy itself takes only 1-2 ms per page.
  • Support for any other WSGI-enabled web server or adapter, including Apache, IIS, lighttpd, mod_python, FastCGI, SCGI, and mod_wsgi.
  • A native mod_python adapter.
  • Multiple HTTP servers (e.g. on multiple ports) at once.
  • A plugin system. CherryPy plugins hook into events within the server process — into server startup, server shutdown, server exiting, etc. — to run code that needs to be run when the server starts up or shuts down.
  • Built-in tools for caching, encoding, sessions, authorization, static content, and others. CherryPy tools hook into events within the request process. Whenever the CherryPy server receives a request, there is a specific set of steps it goes through to handle that request. Page handlers are only one step in the process. Tools also provide a syntax and configuration API for turning them on and off for a specific set of handlers.
  • A configuration system for developers and deployers. CherryPy deployments are configurable on site, on application and on controller level, through Python dictionaries, configuration files, and open file objects.
  • Every component is swappable and customizable.
  • A complete test suite:
    • tests for both basic and advanced functionality
    • command-line options to control which tests are run, and the output they produce
    • debugging tools specifically for web page tests
    • many of the test suite components are reusable by applications.
  • Built-in profiling since v2.1, coverage and testing support.
1372 questions
5
votes
2 answers

fastcgi, cherrypy, and python

So I'm trying to do more web development in python, and I've picked cherrypy, hosted by lighttpd w/ fastcgi. But my question is a very basic one: why do I need to restart lighttpd (or apache) every time I change my application code, or the code for…
Wells
  • 10,415
  • 14
  • 55
  • 85
5
votes
4 answers

CherryPy (or other Python framework) with FastCGI on shared host

I am trying to configure the Python mini-framework CherryPy with FastCGI (actually fcgid) on Apache. I am on a shared host, so I don't have access to httpd.conf, just htaccess. I have followed these tutorials to no…
arshaw
  • 2,750
  • 22
  • 32
5
votes
1 answer

Streaming files with cherrypy

I am trying to stream a video file using cherrypy. When I go to localhost:8080/stream?video=video.avi it starts downloading, but after a few seconds it just "completes" the download no matter how large the file is. I'm rather new to this and cannot…
Urho
  • 2,232
  • 1
  • 24
  • 34
5
votes
2 answers

How do I use a global variable in cherrypy?

I need to access a global variable that keeps its state over diffferent server requsts. In this example the global variable is r and it is incremented at each request. How can I make r global in cherrypy? import cherrypy import urllib class…
Mirko Cianfarani
  • 2,023
  • 1
  • 23
  • 39
5
votes
1 answer

CherryPy: How to restrict a route to POST-only

I've a web-form that looks like:
The python class to handle this…
Mayank
  • 5,454
  • 9
  • 37
  • 60
5
votes
4 answers

Adding HTTP Basic Authentication Header to Backbone.js Sync Function Prevents Model from Being Updated on Save()

I'm working on a web application that is powered by a restful API written with Python's CherryPy framework. I started out writing the user interface with a combination of jQuery and server side templates, but eventually switched to Backbone.js…
5
votes
3 answers

Python Cherrypy: Disable logging of requests

I'm trying to silence the logging of http requests from CherryPy. I've tried cherrypy.log.access_file = None which as I understand it should remove the handler for access logging, but I can't seem to get it to work.
Ben Davis
  • 617
  • 2
  • 11
  • 19
5
votes
1 answer

"Fatal Python error: Couldn't create autoTLSkey mapping" with CherryPy

I have a CherryPy webapp that used to work nicely on Ubuntu Lucid (Python 2.6.5) but now on Ubuntu Precise (Python 2.7.3) it quits on startup with the following: Listening for SIGHUP. Listening for SIGTERM. Listening for SIGUSR1. Bus…
Joril
  • 19,961
  • 13
  • 71
  • 88
5
votes
2 answers

How to execute asynchronous post-processing in CherryPy?

Context: Imagine that you have a standard CherryPy hello word app: def index(self): return "Hello world!" index.exposed = True and you would like to do some post-processing, i.e. record request processing or just log the fact that we…
stic
  • 1,008
  • 3
  • 10
  • 23
4
votes
1 answer

Cherrypy form validation

What do most cherrypy developers do for server side form validation? I've done a google but nothing jumped out as "the one way to do it".
MKaras
  • 2,063
  • 2
  • 20
  • 35
4
votes
4 answers

Serving css file from CherryPy

I'm having a devil of a time getting CherryPy to serve the necessary css file for the page returned. My directory structure: Application ab.py (CherryPy application) ab.config (CherryPy config file) html\ …
Larry Lustig
  • 49,320
  • 14
  • 110
  • 160
4
votes
2 answers

Problems serving static files favicon.ico and robots.txt in CherryPy 3.1

When I try to browse to favicon.ico, for instance, I get this error: ValueError: Static tool requires an absolute filename (got 'favicon.ico') I can get to anything in my /images, /css and /js folders. Those are serving just fine. The site looks…
101010
  • 14,866
  • 30
  • 95
  • 172
4
votes
2 answers

HTTPS to HTTP using CherryPy

Is it possible for CherryPy to redirect HTTP to HTTPS. Lets for example say the code below is http://example.com if someone visits via https://example.com I want them to be redirected to the plain HTTP URL (301 redirect maybe?) how do I accomplish…
Mike
  • 1,784
  • 1
  • 12
  • 12
4
votes
1 answer

Make CherryPy exit immediately upon receiving a keyboard interrupt?

Is there an easy way of making CherryPy perform an os._exit(0) once it gets a ^C interrupt? It would normally wait for all the threads to terminate which is not useful for debugging as I expect it to shut down immediately.
Kristina
  • 15,859
  • 29
  • 111
  • 181
4
votes
1 answer

CherryPy BackgroundTask

I need a simple example of invoking the cherrypy.process.plugins.BackgroundTask. I tried it out but can't seem to get it to work (no examples in the docs). Here is my code: def func(): print "blah blah blah" wd =…
michael
  • 2,577
  • 5
  • 39
  • 62