瘦青蛙 回复于:2005-06-17 08:23:55
[size=24]Creating a Web Application[/size]
The web application that you will be making is essentially a lot of files in one or more directories. Static content files such as html files and images, dynamic content files such as Ypages, and web application code itself (python source code files). This chapter shows how they all fit together.
我们创建的web 应用程序基本上都是有很多文件或者文件夹组成的。静态页面包括html和图片,动态内容一般都是Ypage,还有web应用程序本身代码(python源代码文件)。这章将阐述它们之间是如何协调工作的。
FIrst you have to create and configure your web application, and then you must fill it with web pages.
首先您应该创建并配置您的web应用程序,之后添入我们需要的页面文件。
[size=18]Setting up the web application [/size]
Put your stuff in a Python module in the "webapps" directory. The directory (module) name is also the name and URL context name of your web application. So when your webapp is in a directory called store, it will be accessible with the URL http://server.com/store/ There is one special reserved name: if you have a web app named "ROOT" that one will be used as the web application for the root context '/'. (When you are using Virtual Hosting settings, you can change this, it is only used when no vhosts are defined).
将您的源文件放到 webapps目录中。这个目录(模块)的名称跟您的web 应用程序的URL 名称相关。如果您的webapp被存储到文件夹 store中的时,您就可以通过http://server.com/store/ 来访问他,这里还有特殊的保留目录名:ROOT,相当于web 应用程序的根目录 ‘/’。(当您正在使用虚拟主机时,您可以对其进行修改,当没有定义vhosts的时候可以使用他。)
The module's __init__.py must contain the configuration settings for your web app:
模块 __init__.py 包括如下配置内容:
[list]
Attribute属性 Description描述
name The descriptive name for this webapp
webapp的描述名称
docroot The (relative) directory where files are served from, usually "." (which means the directory of the webapp itself). Many webapps also choose to use "docroot" or something similar, and then put all files into a docroot/ subdirectory. This is a bit more secure because it is not possible to access files outside this directory, so you can place code or other data in the webapp directory without worrying about this.
上一页 1 2 3 4 5 6 7 89 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 下一页
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 翻译 文档 使用 可以 页面 URL 如果 文件 webapp 一个 |
注册
个人空间
