Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
nickcheng authored and anandology committed Jan 5, 2011
1 parent f7bf2aa commit 178b99e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions install.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ title: 安装

# 安装

## Summary

* <a href="#install">Install</a>
* <a href="#dev">Development</a>
* <a href="#prod">Production</a>
* <a href="#lighttpd">LightTPD</a>
* <a href="#lighttpdfastcgi">.. with FastCGI</a>
* <a href="#apache">Apache</a>
* <a href="#apachecgi">.. with CGI</a>
* <a href="#apachecgihtaccess"> .. with CGI using .htaccess</a>
* <a href="#apachefastcgi">.. with FastCGI</a>
* <a href="#apachescgi">.. with SCGI</a>
* <a href="#apachemodpython">.. with mod_python</a>
* <a href="#apachemodwsgi">.. with mod_wsgi</a>
* <a href="#apachemodrewrite">.. with mod_rewrite</a>

<a name="install"></a>
## 安装

安装web.py, 请先下载:

http://webpy.org/static/web.py-0.33.tar.gz
Expand All @@ -24,6 +43,7 @@ title: 安装

easy_install web.py

<a name="dev"></a>
## 开发

web.py 内置了web服务器。可以按照 [tutorial](http://webpy.org/tutorial2) 学习如何写一个Web应用。 写完后,将你的代码放到 `code.py` 并如下面的方法来启动服务器:
Expand All @@ -32,6 +52,7 @@ web.py 内置了web服务器。可以按照 [tutorial](http://webpy.org/tutorial

打开你的浏览器输入 [http://localhost:8080/](http://localhost:8080/) 查看页面。 若要制定另外的端口,使用 `python code.py 1234`

<a name="prod"></a>
## 产品

现在所运行 web.py 程序的web服务器是挺不错的, 但绝大多数网站还是需要更加专业一些的web服务器。web.py 实现了 [WSGI](http://www.python.org/dev/peps/pep-0333/) 并能在任何兼容它的服务器上运行。 WSGI 是一个web服务器与应用程序之间的通用API, 就如Java 的 Servlet 接口。 你需要安装 [flup](http://trac.saddi.com/flup) ([download here](http://www.saddi.com/software/flup/dist/)) 使web.py 支持with CGI, FastCGI 或 SCGI, flup提供了这些API的WSGI接口。
Expand All @@ -42,8 +63,10 @@ web.py 内置了web服务器。可以按照 [tutorial](http://webpy.org/tutorial

并运行 `chmod +x code.py` 添加可执行属性。

<a name="lighttpd"></a>
### LightTPD

<a name="lighttpdfastcgi"></a>
#### .. 使用 FastCGI

在产品中通过FastCGI结合lighttpd是web.py使用的一种推荐方法。 [reddit.com][3] 通过该方法来处理百万次的点击。
Expand Down Expand Up @@ -86,8 +109,10 @@ lighttpd config设置参考如下:
)


<a name="apache"></a>
### Apache

<a name="apachecgi"></a>
#### .. 使用 CGI


Expand All @@ -97,6 +122,7 @@ lighttpd config设置参考如下:
ScriptAlias /foo/ /path/to/code.py


<a name="apachecgihtaccess"></a>
#### .. 使用 CGI .htaccess

CGI很容易配置, 但不适合高性能网站。
Expand Down Expand Up @@ -125,6 +151,7 @@ CGI很容易配置, 但不适合高性能网站。

web.internalerror = cgidebugerror

<a name="apachefastcgi"></a>
#### .. 使用 FastCGI

FastCGI很容易配置,运行方式如同mod_python。
Expand All @@ -142,6 +169,7 @@ FastCGI很容易配置,运行方式如同mod_python。

[Walter 还有一些额外建议](http://lemurware.blogspot.com/2006/05/webpy-apache-configuration-and-you.html).

<a name="apachescgi"></a>
#### .. 使用 SCGI
https://www.mems-exchange.org/software/scgi/
http://www.mems-exchange.org/software/files/mod_scgi/ 下载 `mod_scgi` 代码
Expand All @@ -158,6 +186,7 @@ windows apache 用户:
打开你的浏览器,访问127.0.0.1
It's ok!

<a name="apachemodpython"></a>
#### .. 使用 mod_python

mod_python 运行方式如同FastCGI, 但不是那么方便配置。
Expand Down Expand Up @@ -195,6 +224,7 @@ mod_python 运行方式如同FastCGI, 但不是那么方便配置。

确保访问 `/codep.py/` 的时候有添加最后的 `/`。 否则,你将会看到一条错误信息,比如 `A server error occurred. Please contact the administrator.`

<a name="apachemodwsgi"></a>
#### .. 使用 mod_wsgi

mod\_wsgi 是一个新的Apache模块 [通常优于mod_python](http://code.google.com/p/modwsgi/wiki/PerformanceEstimates) 用于架设WSGI应用,它非常容易配置。
Expand Down Expand Up @@ -222,6 +252,7 @@ mod\_wsgi 提供 [许多可行方法](http://code.google.com/p/modwsgi/wiki/Conf

最终应该可以访问 `http://example.com/code.py/`

<a name="apachemodrewrite"></a>
#### mod_rewrite 法则,Apache

如果希望 web.py 能够通过 'http://example.com' 访问,代替使用 'http://example.com/code.py/', 添加以下法则到 `.htaccess` 文件:
Expand Down

0 comments on commit 178b99e

Please sign in to comment.