fastcgi,cherrypy和python [英] fastcgi, cherrypy, and python

查看:69
本文介绍了fastcgi,cherrypy和python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我尝试使用python进行更多的Web开发,并且我选择了由lighttpd w/fastcgi托管的cherrypy.但是我的问题是一个非常基本的问题:为什么每次更改应用程序代码或基础库的代码时,都需要重新启动lighttpd(或apache)?

So I'm trying to do more web development in python, and I've picked cherrypy, hosted by lighttpd w/ fastcgi. But my question is a very basic one: why do I need to restart lighttpd (or apache) every time I change my application code, or the code for an underlying library?

我意识到这个问题源于对fastcgi模型的基本误解(即较差的理解),因此我愿意接受这里的任何学习,但是我习惯于仅更改PHP文件并显示它,而不是弹跳Web服务器.

I realize this question extends from a basic mis(i.e. poor)understanding of the fastcgi model, so I'm open to any schooling here, but I'm used to just changing a PHP file and it showing up, versus having to bounce the web server.

任何说明/有用的嘲笑表示赞赏.

Any elucidation/useful mockery appreciated.

推荐答案

这是因为性能.对于开发而言,自动重装很有帮助.但是对于生产来说,您不想要自动重新加载.实际上,这在PHP中是一个相当大的瓶颈.每次访问PHP网页时,服务器都必须从头开始解析并加载每个页面.使用Python,该脚本已在首次访问后加载并运行.

This is because of performance. For development, autoreloading is helpful. But for production, you don't want to autoreload. This is actually a decently-sized bottleneck in say PHP. Every time you access a PHP webpage, the server has to parse and load each page from scratch. With Python, the script is already loaded and running after the first access.

如前所述,CherryPy具有自动重载设置.我建议使用CherryPy内置服务器进行开发,并使用lighttpd进行生产.这样可能会节省您一些时间. 教程展示了如何执行此操作.

As has been pointed out, CherryPy has a autoreload setting. I'd recommend using the CherryPy built-in server for development and using lighttpd for production. That will likely save you some time. The tutorial shows you how to do this.

这篇关于fastcgi,cherrypy和python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆