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
9
votes
4 answers

How to return an image in an HTTP response with CherryPy

I have code which generates a Cairo ImageSurface, and I expose it like so: def preview(...): surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) ... cherrypy.response.headers['Content-Type'] = "image/png" return…
colinmarc
  • 2,421
  • 1
  • 22
  • 34
9
votes
2 answers

Running more than one class in Cherrypy

I'm trying to build a small site with an index etc. and an api that I want in /api. For example: class Site(object): @cherrypy.expose def index(self): return "Hello, World!" @cherrypy.expose def contact(self): return…
joedborg
  • 17,651
  • 32
  • 84
  • 118
9
votes
2 answers

how to shut down cherrypy server?

im on win7 ,i started a tutorial helloworld.py and everything doing fine but i don't know how to quit the service.i use quit() but command line give me an error message and exit.but service is still running and take my 8080 port. i hadn't find a…
Max
  • 7,957
  • 10
  • 33
  • 39
8
votes
1 answer

Flask, CherryPy and static content

I know there are plenty of questions about Flask and CherryPy and static files but I still can't seem to get this working. There's a snippet to deploy a Flask app on CherryPy here: http://flask.pocoo.org/snippets/24/ Is there a quick modification to…
MKaras
  • 2,063
  • 2
  • 20
  • 35
8
votes
1 answer

Static html Files in Cherrypy

I am having an issue with what should be a basic concept in cherrypy but as yet I have been unable to find a tutorial or example on how to do this (I am a Cherrypy newbie, be gentle). The Problem. (This is a Test piece hence the lack of robust…
Kraken18
  • 663
  • 2
  • 11
  • 25
8
votes
3 answers

How to read parameters from GET request in CherryPy?

How to read parameters from GET request in CherryPy ? I generate request from JQuery like $.get( "http://localhost:8080/temp", "{a:10}", function(data) { alert(data); }, "html" ); and I have class temp with @cherrypy.expose…
Jana
  • 529
  • 2
  • 7
  • 8
8
votes
2 answers

Combine client-side and server-side validation in Bootstrap 4 form

I have a Bootstrap 4 form with an input field, called runname. I want to perform the following validation on the input field: runname cannot be empty runname cannot contain spaces runnamecannot already be used previously I already have the code…
BioGeek
  • 21,897
  • 23
  • 83
  • 145
8
votes
3 answers

2-way SSL with CherryPy

From CherryPy 3.0 and onwards, one-way SSL can be turned on simply by pointing to the server certificate and private key, like this: import cherrypy class HelloWorld(object): def index(self): return "Hello SSL World!" index.exposed…
8
votes
3 answers

lessphp fatal error: load error: failed to find error after migrating wordpress website to new server

We are seeing the following error after migrating a WordPress site from one server to another. lessphp fatal error: load error: failed to find…
cerhelp
  • 81
  • 1
  • 1
  • 4
8
votes
1 answer

CherryPy behind Nginx reverse-proxy POST requests corrupted/truncated

I have put my application using Cherrypy 3.1.2 behind Nginx configured as a reverse-proxy. All is working right for GET requests, but all POST requests return HTTP 400 - Malformed header. I traced into CherryPy WSGI-Server source code to see the…
Adam Kania
  • 81
  • 1
  • 3
8
votes
2 answers

Creating portable Django apps - help needed

I'm building a Django app, which I comfortably run (test :)) on a Ubuntu Linux host. I would like to package the app without source code and distribute it to another production machine. Ideally the app could be run by ./runapp command which starts a…
stricjux
  • 1,394
  • 12
  • 13
8
votes
1 answer

CherryPy redirect to root

quick question: I have created a web server using CherryPy. It requires authentication for all pages, so my default handler returns the login page object. Due to the way that CherryPy handles the dispatches, somebody who…
Muppet
  • 5,767
  • 6
  • 29
  • 39
7
votes
1 answer

Why CherryPy session does not require a secret key?

I noticed that cherrypy session does not require a secret key configuration. On the contrary, Pylons session does: http://docs.pylonsproject.org/projects/pylons_framework/dev/sessions.html I'm concerned about security issues if I'm using session to…
KFL
  • 17,162
  • 17
  • 65
  • 89
7
votes
1 answer

Memory consumption in Cherrypy

I am using Cherrypy in a RESTful web service and server returns XML as a result (lxml is being used to create XML). Some of those XMLs are quite large. I have noticed that memory is not being released after such request (that return large XML) has…
kevin
  • 2,172
  • 3
  • 18
  • 19
7
votes
1 answer

Cherrypy : Do I really need to put it behind a frontend?

I've been working on a python web app using cherrypy and read it'd be more "robust" to use it as a backend, so I gave it a try. Shortly put, running some benchmarks on a page doing some database operations and serving static & dynamic content has…
felace
  • 993
  • 1
  • 12
  • 21