Mod python

Mod python

mod_python is an Apache HTTP Server module that integrates the Python programming language into the Apache server. It is intended to replace Common Gateway Interface (CGI) as a method of executing Python scripts on a web server. The promised benefits are faster execution speed and maintaining data over multiple sessions.

Benefits

Ordinary CGI execution starts a new process every time a connection is made to a script on the server. This works well in low to medium traffic sites, but does not scale well when used on a high traffic site. There are methods of enhancing the performance of CGI, such as FastCGI, but it is often easier to use a specialized module to embed the desired language into the web server itself. This is exactly what mod_python is designed to do. Since the process is not terminated after the script execution like CGI, persistent data can be stored, such as database connections. This may reduce script execution overhead.

Since mod_python modules are integrated with the web server, they can do almost anything an Apache module written in C can do: implement protocols besides HTTP, filter the request and response, determine a document's content type, etc.

Another advantage to mod_python is that it can talk directly to Apache's core system, and interface as well as actually control the heart of Apache. This is done by handlers that the programmer specificies in the Apache configuration file, and every client request directed at that specific directory will not be processed by Apache, rather by mod_python and a "Main" function that handles all requests.

Using mod_python also has the advantage of Python Server Pages (PSP), a way to embed Python code into HTML pages, similar to ASP, PHP, and JavaServer Pages (JSP).

Problems

Embedding the Python interpreter (and different Python applications) directly into the Apache process is not without problems, especially when looking at shared Python web application hosting:
* all hosted applications run under the same uid/gid (bad for security and separation of different users' web applications)
* restarting Apache (usually needs root user priviledges) might be necessary:
** if some Python code malfunctions
** in case of memory leaks
** after a user upgraded his Python code

Additionally to the problematic "embedded mode" offered by Mod_python, mod wsgi (another alternative Apache module for running Python web applications) also offers a "daemon mode" that is more secure and easier handled for a non-root webhosting user.

History

The initial implementation ofmod_python was originally written by Aaron Watters and distributed on the CD for the book "Internet Programming with Python".The First version of mod_python as modified by Gregory Trubetskoy was released in 2000. In September 2002 mod_python was donated to the Apache Software Foundation and became part of the Apache HTTP Server project.

ee also

*Apache HTTP Server
*mod wsgi
*mod jk
*mod perl
*mod parrot
*Spyce

External links

* [http://modpython.org/ Official mod_python website]
* [http://webpython.codepoint.net/mod_python mod_python Tutorial]
* [http://www.modpython.org/live/current/doc-html/ mod_python manual]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Mod python — ist ein Modul für den Apache HTTP Server, das die Programmiersprache Python in den Webserver einbindet. Ziel war die Ablösung des „Common Gateway Interface“ (CGI) zur Ausführung von Python Skripten. Vorteil ist hauptsächlich die schnellere… …   Deutsch Wikipedia

  • Mod python — mod python  модуль веб сервера Apache, который встраивает в него интерпретатор языка Python. Mod python позволяет добиться более высокой скорости выполнения веб приложений на этом языке, чем при использовании CGI. В настоящее время проект по …   Википедия

  • Python (Programmiersprache) — Python Basisdaten Paradigmen: multiparadigmatisch Erscheinungsjahr: 1991 …   Deutsch Wikipedia

  • Mod jk — используется для того, чтобы связывать контейнер сервлетов Tomcat с веб серверами, такими как Apache, Netscape, iPlanet, SunOne и даже IIS, используя протокол Apache JServ Protocol. Ссылки http://tomcat.apache.org/connectors doc/ См. также JSP… …   Википедия

  • Mod wsgi — модуль для веб сервера Apache, который предоставляет WSGI совместимый интерфейс для работы с web приложениями, написанными на языке программирования Python. Разрабатывается Грэмом Дамплтоном (ранее, один из разработчиков mod python[1]) Содержание …   Википедия

  • Mod wsgi — ist ein Modul für den Apache HTTP Server, das die Ausführung von Python Programmen durch den Webserver ermöglicht. WSGI ist eine allgemeine Schnittstelle zwischen Webserver und Python Anwendungen. mod wsgi macht eine Vermittlungsschicht zwischen… …   Deutsch Wikipedia

  • Mod perl — ist ein freies optionales Modul für den Apache Webserver, welches einen Perl Interpreter in den Webserver integriert. Auf diese Weise können Perl Skripte für dynamische Web Inhalte ausgeführt werden, ohne dass für jede HTTP Anfrage der Perl… …   Deutsch Wikipedia

  • Mod parrot — is an optional module for the Apache web server. It embeds a Parrot virtual machine interpreter into the Apache server and provides access to the Apache API to allow handlers to be written in Parrot assembly language, or any high level language… …   Wikipedia

  • mod jk — используется для того, чтобы связывать контейнер сервлетов Tomcat с веб серверами, такими как Apache, Netscape, iPlanet, SunOne и даже IIS, используя протокол Apache JServ Protocol. Ссылки http://tomcat.apache.org/connectors doc/ См. также JSP… …   Википедия

  • Mod (computer gaming) — Mod or modification is a term generally applied to computer games, especially first person shooters, RPGs and real time strategy games. Mods are made by the general public or a developer, and can be entirely new games in themselves, but mods are… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”