V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Tornado Documentation
http://www.v2ex.com/tornado/
Tornado on GitHub
https://github.com/facebook/tornado/
Tornado Gists
http://tornadogists.org/
kenneth
V2EX  ›  Tornado

如何用写这样的url映射?

  •  
  •   kenneth · 2013-10-11 01:10:41 +08:00 · 4305 次点击
    这是一个创建于 3821 天前的主题,其中的信息可能已经有所发展或是发生改变。
    static.xxx.com

    对应
    (r"/(.*)", tornado.web.StaticFileHandler, dict(path=settings['static_path'])),

    但是图片
    http://static.xxx.com/static/test.jpg 可以访问

    如何配置成
    http://static.xxx.com/test.jpg 因为我不想要static

    请问如何配置?
    2 条回复    1970-01-01 08:00:00 +08:00
    BOYPT
        1
    BOYPT  
       2013-10-11 09:03:35 +08:00
    如果你做个专用的静态资源域名,就不要传给 tornado 来读静态资源了,直接在web前端比如nginx读取就是,这么做只能效率低。

    如果你一定要这么做(比如本地调试), 直接 ("/", tornado.web.StaticFileHandler, dict(path=settings['static_path'])),不就完了。
    est
        2
    est  
       2013-10-11 09:24:27 +08:00
    没有成本低的办法。根目录静态文件一直是大问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3002 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:49 · PVG 22:49 · LAX 07:49 · JFK 10:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.