cherrypy

Python: sending and receiving large files over POST using cherrypy

喜欢而已 提交于 2019-12-28 18:49:35
问题 I have a cherrypy web server that needs to be able to receive large files over http post. I have something working at the moment, but it fails once the files being sent gets too big (around 200mb). I'm using curl to send test post requests, and when I try to send a file that's too big, curl spits out "The entity sent with the request exceeds the maximum allowed bytes." Searching around, this seems to be an error from cherrypy. So I'm guessing that the file being sent needs to be sent in

Deploying CherryPy (daemon)

别说谁变了你拦得住时间么 提交于 2019-12-28 11:55:09
问题 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...) Thanks! 回答1: There is a Daemonizer plugin for CherryPy included by default which is useful for getting it to start but by far the easiest way for simple cases

Deploying CherryPy (daemon)

点点圈 提交于 2019-12-28 11:54:17
问题 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...) Thanks! 回答1: There is a Daemonizer plugin for CherryPy included by default which is useful for getting it to start but by far the easiest way for simple cases

Cherrypy - reciving JSON data 404, 'Missing parameters'

旧城冷巷雨未停 提交于 2019-12-25 09:19:29
问题 I'm making my own site from scratch using Cherrypy Postgresql. I am a beginner with Python and Javascript but I am very enthusiastic about learning those two programming languages. What I am trying to achieve right now is to fill up HTML form -> Send data using JSON by AJAX -> Define Rights for a visitor -> and redirect to index after its all done. I am fighting with this error for days because I cannot find an example on the internet how to send data in python by AJAX using JSON As I said I

How to make CherryPy serve concurrent requests?

試著忘記壹切 提交于 2019-12-24 13:51:34
问题 I have read that cherrypy uses a threadpool of its own. But I am unable to see the advantage of that. Let's say I fire off a request which will take a long time and after that in another tab I fire off a request which will take a short time. If it really uses multithreading, the short request should complete before the long one. But I am seeing that first the long request gets completed and then the short time, as if everything is processed sequentially. I have tried integrating with

cherrypy: respond to url that includes a dot?

孤街浪徒 提交于 2019-12-24 12:44:06
问题 Is there a way to get CherryPy to respond to a url that includes a period, such as http://some/base/path/oldscript.py ? I have a number of old CGI scripts that were called like that, and I'm trying to roll them into a nice pretty CherryPy web app - but I don't want to break all the bookmarks and the like that still point to the CGI scripts. Ideally the same method would respond to the url regardless of if it has a .py or not. 回答1: Turns out using an _ in the method definition works as a dot

time.gmtime() causes OverflowError on armhf platform

只愿长相守 提交于 2019-12-24 11:25:34
问题 I have a webserver (CherryPy) running with on a Cubox (armhf platform) and upon starting the wever i get the following error: [14/Aug/2015:09:33:40] HTTP Traceback (most recent call last): File "(...)/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 661, in respond self.hooks.run('before_request_body') File "(...)/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 114, in run raise exc File "(...)/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 104, in run hook()

How to have multiple clients listen to a server sent event?

谁说胖子不能爱 提交于 2019-12-24 10:35:48
问题 I am trying to get my head around server sent events. The rest of my site is served using cherrypy, so I want to get them working on this platform too. The method I'm using to expose the SSE: @cherrypy.expose def interlocked(self, _=None): cherrypy.response.headers["Content-Type"] = "text/event-stream;charset=utf-8" if _: data = 'retry: 400\n' while not self.interlockUpdateQueue.empty(): update = self.interlockUpdateQueue.get(False) data += 'data: ' + str(update) + '\n\n' return data else:

How to put Cherrypy wsgi behind Nginx?

ⅰ亾dé卋堺 提交于 2019-12-24 09:28:18
问题 I was following by lalalalalalalambda example to put cherrypy behind nginx server, but didn't acomplish anything except nginx 502 bad gataway at my home Debian distro. Here is Nginx settings : location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8080; } Ofcourse there is IP instead of socket, but tried hard to make it work by following numerious of examples over the net. I'm hosting several domains with static html in production server, and trying to switch to python. I hope if I solve

Firefox doesn't restore server-sent events connection

我们两清 提交于 2019-12-23 20:05:52
问题 Test case implemented with Python and CherryPy: import cherrypy, time class Root(): @cherrypy.expose def index(self): return r'''<!DOCTYPE html> <html> <head> <title>Server-sent events test</title> <style>html,body,#test{height:98%;}</style> </head> <body> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', function () { var source = new EventSource('gettime'); source.addEventListener('time', function (event) { document.getElementById('test').innerHTML += event.data