cherrypy

Python web programming

Good morning. As the title indicates, I've got some questions about using python for web development. What is the best setup for a development environment, more specifically, what webserver to use, how to bind python with it. Preferably, I'd like it to be implementable in both, *nix and win environment. My major concern when I last ...

Best practice for integrating CherryPy web-framework, SQLAlchemy sessions and lighttpd to serve a high-load webservice

I'm developing a CherryPy FastCGI server behind lighttpd with the following setup to enable using ORM SQLAlchemy sessions inside CherryPy controllers. However, when I run stress tests with 14 concurrent requests for about 500 loops, it starts to give errors like AttributeError: '_ThreadData' object has no attribute 'scoped_session_class'...

python postgres cursor timestamp issue

I am somewhat new to transactional databases and have come across an issue I am trying to understand. I have created a simple demonstration where a database connection is stored inside each of the 5 threads created by cherrypy. I have a method that displays a table of timestamps stored in the database and a button to add a new record...

soaplib with mod_wsgi/cherrypy

Hi guys, I've followed the tutorials for setting up Apache with mod_wsgi to interface cherrypy and make a site running of it. This is my "myapp.wsgi", and opening http://localhost/ works great. Opening http://localhost/ape/ actually returns the text instead of a soap-response, and http://localhost/ape/service.wsdl returns a 500 HTTP erro...

How do I set Session name with Cherrypy?

In PHP I would do it like this: session_name("special_session_name"); So how do I do it with Cherrypy? Just need to find exact equivalent for it. PHP manual page: http://fi2.php.net/session_name ...

How to use cherrypy as a web server?

Hello. 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): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorl...

CherryPy Hello World error

When I am running CherryPy Hello World: import cherrypy class HelloWorld: def index(self): return "Hello world!" index.exposed = True cherrypy.config.update({'server.socket_port': 8080,}) cherrypy.quickstart(HelloWorld()) ... I get this: IOError: Port 8080 not bound on 'localhost'. What could it be? ...

serve_file for any file object

In cherrypy.lib.static.py there is a method: serve_file(path, content_type=None, disposition=None, name=None) where the argument "path" must be a real file (absolute path). Is there something similar to serve any Python file object? ...

Install CherryPy on Linux hosting provider without command line access

I have a linux based web hosting provider (fatcow.com) that doesn't give any command line access and won't run the setup script for CherryPy (python web server) for me. Is there any way to run get around this limitation so that I have a working install of CherryPy? This might be more or a serverfault.com question, but maybe someone her...

Which template technology should I use with CherryPy?

I'm in the process of building a web application using cherrypy. What template technology do you recommend I use? ...

Handle sys.exit() in cherrypy service

When you start/stop a python cherrypy service (compiled with py2exe), this works fine When I get a sys.exit() call (from my error handler), cherrypy quits, but the service remains hanging. Code: import cherrypy import win32serviceutil import win32service import sys SERVICE = None class HelloWorld: """ Sample request handler clas...

Cherrypy server does not accept incoming http request on MS Windows if output (stdout) is not redirected

It is a rather strange 'bug'. I have written a cherrypy based server. If I run it this way: python simple_server.py > out.txt It works as expected. Without the the redirection at the end, however, the server will not accept any connection at all. Anyone has any idea? I am using python 2.4 on a Win XP professional machine. ...

CherryPy interferes with Twisted shutting down on Windows

I've got an application that runs Twisted by starting the reactor with reactor.run() in my main thread after starting some other threads, including the CherryPy web server. Here's a program that shuts down cleanly when Ctrl+C is pressed on Linux but not on Windows: from threading import Thread from signal import signal, SIGINT import ...

Help me to better understand CherryPy PageHandlers

Let's say I have some code (using CherryPy) that looks like this: import cherrypy class Names: def index(self, name=None): return "Names.index: " + str(name) index.exposed = True class Root: def index(self): return "This is the root" index.exposed = True if __name__ == "__main__": root = Root() ...

Why don't Django and CherryPy support HTTP verb-based dispatch natively?

It's not the same to POST to an URL than to GET it, DELETE it or PUT it. These actions are fundamentally different. However, Django seems to ignore them in its dispatch mechanism. Basically, one is forced to either ignore HTTP verbs completely or do this on every view: def my_view(request, arg1, arg2): if request.method == 'GET': ...

How to execute asynchronous post-processing in CherryPy?

Hi, 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 were called from specific IP. What you would do is probably: def index(self): sel...

Time out error while creating cgi.FieldStorage object

Hey, any idea about what is the timeout error which I am getting here: Error trace: File "/array/purato/python2.6/lib/python2.6/site-packages/cherrypy/_cprequest.py", line 606, in respond cherrypy.response.body = self.handler() ...

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 standard recipe? Maybe something that will create a service script (/etc/init.d/cherrypy.....

How to shutdown cherrypy from within?

I am developing on cherrypy, I start it from a python script. For better development I wonder what is the correct way to stop cherrypy from within the main process (and not from the outside with ctrl-c or SIGTERM). I assume I have to register a callback function from the main application to be able to stop the cherrypy main process fro...

Using CherryPy as a blocking/non-threading server for easier debugging

Is it possible to use the CherrPy server as a blocking/non-threading server (for easier debugging?) ...