阅 读 文 章

snakelets 文档,我翻译了一部分。

[来源:网上转载 (http://www.chinaunix.net) | 作者:网友(瘦青蛙) | 时间:2007-05-27 | 浏览:人次 ]


文件服务目录(相对目录),一般为 ‘.’(webapp的目录从属关系)。一般的webapp都使用 “docroot” 或者类似的名称,并将所有文件放到docroot/ 的子目录中。这是比较安全的,因为外部不能访问此目录中的文件,所以您可以比较放心得将您的代码或者是数据存放到此目录中。

assetLocation The (relative or absolute) url location where static assets are to be found. If you use a relative location ("static/img/" for instance), the assets are located inside the webapp's docroot (use "." to use the docroot directory itself, instead of a directory inside it). If you use an absolute location ("/static/" for instance), the assets are located in another web app or path entirely (but still on the same web server). It is also possible to put a totally different url here such as "http://images.server.com/img/" to be able to serve static assets (images, files) from an entirely different server. This setting is used by the asset Ypage function and the mkAssetUrl Webapp function.
可以访问到静态文件的url路径(相对 或 绝对)。如果您使用相对路径(比如 “static/img/”),所有文件都被放置到 webapp的docroot中(可以通过 ‘.’来使用docroot目录)。如果使用绝对路径(”/static/”),所有文件将被放到其他的 web app或者路径中(但是仍然使用同一个 web server)。也可以将文件(图片,文件)放到完全不同web server的url中,比如 http://images.server.com/img/ 。设置此项可以通过 asset Ypage函数 和 mkAssetUrl Webapp函数。

snakelets a dict that maps (relative) URL patterns to snakelet classes. With this you define the snakelets in your web application, and on what URLs they are 'listening'. Don't forget to import the required modules/classes. You can use 'fnmatch'-style patterns here, for instance: docs/*.pdf would let the snakelet listen on any URL that matches this pattern, such as http://.../docs/report.pdf (the full URL must match the pattern). If you don't use a pattern, any URL that starts with the string matches. Note that if you use fnmatch-patterns, you cannot use path info arguments anymore (only query args): http://.../docs/report.pdf/path/info?foo=bar doesn't work, but http://.../docs/report.pdf?foo=bar still does. See below how you can use Snakelets as virtual index pages.
论坛热门帖子: [lch203] 写得蛮好的linux学习笔记(10-21)
[黑马制造] 学习java的30个目标(10-19)
[笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19)
[udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18)
[沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18)
TAG标签: 翻译 文档 使用 可以 页面 URL 如果 文件 webapp 一个

最新评论 共有1位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表

网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.