cherrypy

How do I build an WSGI apps built with CherryPyWSGIServer that support both HTTP and HTTPS?

I built a WSGI app and created a standalone wrapper using CherryPyWSGIServer. I see that CherryPyWSGIServer supports HTTPS but I am not sure how to support both HTTP and HTTPS together as it looks like the first server.start() blocks. How would I create two servers, one HTTP and one HTTPS, and start them both? Here is what I have now: ...

Python: deferToThread XMLRPC Server - Twisted - Cherrypy?

This question is related to others I have asked on here, mainly regarding sorting huge sets of data in memory. Basically this is what I want / have: Twisted XMLRPC server running. This server keeps several (32) instances of Foo class in memory. Each Foo class contains a list bar (which will contain several million records). There is...

Is CherryPy a robust webserver (ie, is it reliable under a huge load like Apache)?

I'm wondering because CherryPy is, from my knowledge, built purely in Python, which is obviously slower than C et al. Does this mean that it's only good for dev / testing environments, or could I use it behind NGINX like I use Apache with Fast CGI currently? ...

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 request-handling code and found out that if for GET requests the first request line correctl...

How do you assign a wsgi app to the root of cherrypy via the config file?

How do you assign a wsgi app to the root of cherrypy via the config file? I'd like the request "http://localhost:8080/" to route to my own wsgiapp. I'm using cherryd to start a cherrypy server with a config file as follows: Here's the invocation: cherryd --config config.cfg --import myapp Here's the config.cfg file: [global] server...

how to use cherrpy built in data storage

Ok I have been reading the cherrypy documents for sometime and have not found a simple example yet. Let say I have a simple hello world site, how do I store data? Lets say I want to store a = 1, and b =2 to a dictionary using cherrypy. The config files are confusing as hell. Anyone have very simple example of storing values from a si...

Problems serving static files in CherryPy 3.1

Hi All, I'm having some trouble serving a static XML stylesheet to accompany some dynamically generated output from a CherryPy web app. Even my test case serving a static text file fails. Static file blah.txt is in the /static directory in my application root directory. In my main site file (conesearch.py contains the CherryPy ConeSea...

Dynamically creating page definitions in Cherrypy

Hi, I've been looking around the CherryPy documentation, but can't quite get my head around what I want to do. I suspect it might be more of a Python thing than a CherryPy thing... My current class looks something like this: import managerUtils class WebManager: def A(self, **kwds): return managerUtils.runAction("A", kwds...

Cheetah with Cherrypy: how to load base templates, and do so automatically on change during development

I am working on a cherrypy+cheetah app and would like to improve the development experience. I have everything working when I manually compile templates beforehand. (Update: This is how things work for production: precompile, don't ship *.tmpl and load templates as regular python modules.) However, during development I'd rather just loa...

Open Source Alternative to ASP.NET membership

I'm currently supporting a Python web app with increasingly complicated user/role/permission management requirements. Currently, we are rolling our own user, groups, permissions, etc. code and supporting database. I'd like to find something like ASP.NET membership that can help manage user authentication and authorization, rather than ...

CherryPy sessions for same domain, different port

Consider the script below. It will launch two subprocesses, each one a CherryPy app (hit Ctrl+C or whatever the KeyboardInterrupt combo is on your system to end them both). If you run it with CP 3.0 (taking care to change the 3.0/3.1 specific lines in "StartServer"), then visit: http://localhost:15002/ ...you see an empty dict. Then v...

What are some best practices for structuring cherrypy apps?

I'm writing a cherrypy app and I was wondering what the best way is for structuring my handlers and code for larger applications? I realize assignment is simple trough cherrypy.root, but what are some practices for writing the handlers and assigning them? (Allow me to prove my confusion!) My initial thought is to write a standard handl...

Python Framework for small website

I am planning a small, simple website to showcase myself as an engineer. My preferred language is Python and I hope to use it to create my website. My pages will be mostly static, with some database stored posts/links. The site will be simple, but I would like to have freedom in how it operates. I plan on using CSS/JS for the design, so...

Can PyAMF support service deployment by way of the filesystem?

I'm evaluating PyAMF to replace our current PHP (ugh) AMF services framework, and I'm unable to find the one crucial piece of information that would allow me to provide a compelling use case for changing over: Right now, new PHP AMF services are deployed simply by putting the .php files in the filesystem; the next time they're accessed,...

CherryPy and concurrency

Hi folks, I'm using CherryPy in order to serve a python application through WSGI. I tried benchmarking it, but it seems as if CherryPy can only handle exactly 10 req/sec. No matter what I do. Built a simple app with a 3 second pause, in order to accurately determine what is going on... and I can confirm that the 10 req/sec has nothing...

Best (or appropriate) WSGI server for this Python script? - Python

Hi folks, I'm having quite a problem deciding how to serve a few Python scripts. The problem is that the basic functionality could be generalized by this: do_something() time.sleep(3) do_something() I tried various WSGI servers, but they have all been giving me concurrency limitations, as in I have to specify how many threads to u...

CherryPy and RESTful web api

What's the best approach of creating a RESTful web api in CherryPy? I've been looking around for a few days now and nothing seems great. For Django it seems that are lots of tools to do this, but not for CherryPy or I am not aware of them. Later edit: How should I use Cherrypy to transform a request like /getOrders?account=X&type=Y into...

Passing data from the cherrypy server-side to javascript client-side

Big picture question. I've got a cherrypy server running with all the shopping cart methods for my e-commerce site written in python. I'm working with jquery on the front end. POSTing to my python methods is easy in javascript, but not passing data the other way. I can send it back with JSON, but not always conveniently. It seems like ...

cherrypy keeps object between page update

hi, people. i'm writing web-server that responds me with a list of files in some folder: test_folder = 'somefolder' class TestLoader(object): data = [] index = 0 def __init__(self, dir): for sub in os.listdir(dir): self.data.append(sub) class TesterServer(object): @cherrypy.expose def index(self)...

How do you access config outside of a request in CherryPy?

I've got a webapp running on CherryPy that needs to access the CherryPy config files before a user creates a request. The docs say to use: host = cherrypy.request.app.config['database']['host'] But that won't work outside of a user request. You can also use the application object when you start the app like so: ... applicatio...