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
1049
votes
10 answers

How to POST JSON data with Python Requests?

I need to POST a JSON from a client to a server. I'm using Python 2.7.1 and simplejson. The client is using Requests. The server is CherryPy. I can GET a hard-coded JSON from the server (code not shown), but when I try to POST a JSON to the server,…
Charles R
  • 17,989
  • 6
  • 20
  • 18
251
votes
11 answers

Cross-origin resource sharing (CORS) post request works from plain javascript, but why not with jQuery

I have a machine on my local lan (machineA) that has two web servers. The first is the in-built one in XBMC (on port 8080) and displays our library. The second server is a CherryPy python script (port 8081) that I am using to trigger a file…
James
  • 4,442
  • 4
  • 19
  • 15
124
votes
4 answers

How to open a web server port on EC2 instance

I'm running a CherryPy web server at 0.0.0.0:8787 on an EC2 instance. I can connect to the web server via local wget on the EC2 machine, but I can't reach the instance from my own remote machine (I connect to EC2 via ssh). Do I need to open up port…
Cat
  • 7,042
  • 8
  • 34
  • 36
44
votes
4 answers

Python - Flask Default Route possible?

In Cherrypy it's possible to do this: @cherrypy.expose def default(self, url, *suburl, **kwarg): pass Is there a flask equivalent?
John Jiang
  • 11,069
  • 12
  • 51
  • 60
38
votes
4 answers

Does SQLAlchemy support caching?

Does SQLAlchemy support some kind of caching so if I repeatedly run the same query it returns the response from cache instead of querying the database? Is this cache automatically cleared when the DB is updated? Or what's the best way to implement…
daniels
  • 18,416
  • 31
  • 103
  • 173
38
votes
1 answer

Mapping a class against multiple tables in SQLAlchemy

# ! /usr/bin/env python # -*- coding: utf-8 -*- # login_frontend.py """ Python 2.7.3 Cherrypy 3.2.2 PostgreSQL 9.1 psycopy2 2.4.5 SQLAlchemy 0.7.10 """ I'm having a problem joining four tables in one…
Jonathan Root
  • 535
  • 2
  • 14
  • 31
36
votes
4 answers

How can I get Bottle to restart on file change?

I'm really enjoying Bottle so far, but the fact that I have to CTRL+C out of the server and restart it every time I make a code change is a big hit on my productivity. I've thought about using Watchdog to keep track of files changing then restarting…
Hubro
  • 56,214
  • 69
  • 228
  • 381
35
votes
6 answers

Why doesn't my condition logic work as expected in Jinja2/CherryPy?

{% if bCat2 == True %}
True
{% else %}
False
Returns
False
even when bCat2 is True. Thanks, Andrew
Andrew Kloos
  • 4,189
  • 4
  • 28
  • 36
35
votes
7 answers

CherryPy vs Django

CherryPy vs Django, which would you use and why?
flybywire
  • 261,858
  • 191
  • 397
  • 503
29
votes
3 answers

How to receive JSON in a POST request in CherryPy?

How to receive JSON from POST requests in CherryPy? I've been to this page, and though it does a good job explaining the API, its parameters, and what it does; I can't seem to figure out how to use them to parse the incoming JSON into an…
bitcycle
  • 7,632
  • 16
  • 70
  • 121
26
votes
4 answers

Deploying CherryPy (daemon)

I've followed the basic CherryPy tutorial (http://www.cherrypy.org/wiki/CherryPyTutorial). One thing not discussed is deployment. How can I launch a CherryPy app as a daemon and "forget about it"? What happens if the server reboots? Is there a…
erikcw
  • 10,787
  • 15
  • 58
  • 75
22
votes
1 answer

Python (CherryPy) web app deployed locally, but not visible over intranet

I've created a Python web app using CherryPy, and have deployed in on my local machine. When I try to view it from another computer in the house, nothing comes back. However, if I create a simple html file, and deploy it with: $ python -m…
Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
21
votes
4 answers

How to use cherrypy as a web server for static files?

Is it any easy way to use CherryPy as an web server that will display .html files in some folder? All CherryPy introductory documentation states that content is dynamically generated: import cherrypy class HelloWorld(object): def index(self): …
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
21
votes
2 answers

CherryPy How to respond with JSON?

In my controller/request-handler, I have the following code: def monkey(self, **kwargs): cherrypy.response.headers['Content-Type'] = "application/json" message = {"message" : "Hello World!" } return message monkey.exposed = True And, in my…
bitcycle
  • 7,632
  • 16
  • 70
  • 121
20
votes
3 answers

How do I configure the ip address with CherryPy?

I'm using python and CherryPy to create a simple internal website that about 2 people use. I use the built in webserver with CherryPy.quickstart and never messed with the config files. I recently changed machines so I installed the latest Python and…
Matt Price
  • 43,887
  • 9
  • 38
  • 44
1
2 3
91 92