HOWTO Use Python in the web — Python v3.0.1 documentation

mod_python

People coming from PHP often find it hard to grasp how to use Python in the web. Their first thought is mostly mod_python because they think that this is the equivalent to mod_php. Actually it is not really. It does embed the interpreter into the Apache process, thus speeding up requests by not having to start a Python interpreter every request. On the other hand, it is by far not “Python intermixed with HTML” as PHP often does. The Python equivalent of that is a template engine. mod_python itself is much more powerful and gives more access to Apache internals. It can emulate CGI, it can work an a “Python Server Pages” mode similar to JSP which is “HTML intermangled with Python” and it has a “Publisher” which destignates one file to accept all requests and decide on what to do then.

But mod_python has some problems. Unlike the PHP interpreter the Python interpreter uses caching when executing files, so when changing a file the whole web server needs to be re-started to update. Another problem ist the basic concept – Apache starts some child processes to handle the requests and unfortunately every child process needs to load the whole Python interpreter even if it does not use it. This makes the whole web server slower. Another problem is that as mod_python is linked against a specific version of libpython, it is not possible to switch from an older version to a newer (e.g. 2.4 to 2.5) without recompiling mod_python. mod_python is also bound to the Apache web server, so programs written for mod_python cannot easily run on other web servers.

These are the reasons why mod_python should be avoided when writing new programs. In some circumstances it might be still a good idea to use mod_python for deployment, but WSGI makes it possible to run WSGI programs under mod_python as well.

HOWTO Use Python in the web — Python v3.0.1 documentation的更多相关文章

  1. Maven异常:Dynamic Web Module 3.0 requires Java 1.6 or newer.

    问题 我目前用的JDK 是java 1.8 ,搭建Maven项目的时候,设置Project facets后,出现来以下problem : Dynamic Web Module 3.0 requires ...

  2. 接口自动化 [授客]基于python+Testlink+Jenkins实现的接口自动化测试框架V3.0

    基于python+Testlink+Jenkins实现的接口自动化测试框架V3.0   by:授客 QQ:1033553122     博客:http://blog.sina.com.cn/ishou ...

  3. 部署一个基于python语言的web发布环境

    ---恢复内容开始--- 1) 一门面向对象的语言 2)拥有丰富的库 3)可移植性 4)免费.开源 5)简单易易学 可做软件开发.人工智能.web开发等等 部署流程: Cnetos7.5+Nginx+ ...

  4. 基于python+Testlink+Jenkins实现的接口自动化测试框架V3.0

    基于python+Testlink+Jenkins实现的接口自动化测试框架V3.0 目录 1. 开发环境2. 主要功能逻辑介绍3. 框架功能简介 4. 数据库的创建 5. 框架模块详细介绍6. Tes ...

  5. python的高性能web应用的开发与测试实验

    python的高性能web应用的开发与测试实验 tornado“同步和异步”网络IO模型实验 引言 python语言一直以开发效率高著称,被广泛地应用于自动化领域: 测试自动化 运维自动化 构建发布自 ...

  6. Python轻量Web框架Flask使用

    http://blog.csdn.net/jacman/article/details/49098819 目录(?)[+] Flask安装 Python开发工具EclipsePyDev准备 Flask ...

  7. 在sublimetext上打造一个兼容virtualenv的web&python开发环境

    利用Sublimetext3&virtualenv 打造一个Web&Python IDE 注: 环境:window|python3;以下使用的sublimetext插件均用packag ...

  8. PSPInstance Object | Web Python

    PSPInstance Object | Web Python The PSPInstance object is available to all PSP pages through the psp ...

  9. python 启动简单web服务器

    有时我们在开发web静态页面时,需要一个web服务器来测试. 这时可以利用python提供的web服务器来实现. 1.在命令行下进入某个目录 2.在该目录下运行命令: python -m Simple ...

随机推荐

  1. Gray Code 解答

    Question The gray code is a binary numeral system where two successive values differ in only one bit ...

  2. 【HDU1879】继续畅通工程(MST基础题)

    真心大水题...不多说. #include <iostream> #include <cstring> #include <cstdlib> #include &l ...

  3. c++ windows下declspec

    一.declspec #ifdef STATIC_LIBS #define DLL_API static #else #define DLL_API __declspec (dllexport) #e ...

  4. c++中可以对类中私有成员中的静态变量初始化吗?

    转载http://www.cnblogs.com/carbs/archive/2012/04/04/2431992.html 问题:我看的书上写的对私有部分的访问可以是公共部分的成员函数,也可以是友员 ...

  5. 异步化DAO的设计和实践

    目前,公司技术规划要求未来所有的服务要全面实现异步化接口,使得每个服务能达到1万/秒的单机性能.我们知道,在一个服务请求中,可能会调用其他服务,还会使用memcache.kv以及mysql等.目前,大 ...

  6. [置顶] vi、akw和sed总结

  7. IOS 退出App

    UIApplication *app = [UIApplication sharedApplication]; [app performSelector:@selector(suspend)]; // ...

  8. 第十四个目标(dp + 树状数组 + 线段树)

    Problem 2236 第十四个目标 Accept: 17    Submit: 35 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Probl ...

  9. 谈谈UIView的几个layout方法-layoutSubviews、layoutIfNeeded、setNeedsLayout...

    最近在学习swift做动画,用到constraint的动画,用到layoutIfNeeded就去研究了下UIView的这几个布局的方法. 下面是做得一个动画,下载地址:https://github.c ...

  10. Android窗口管理服务WindowManagerService显示窗口动画的原理分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8611754 在前一文中,我们分析了Activi ...