_tornado.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:wdom 作者: miyakogi 项目源码 文件源码
def add_static_path(self, prefix: str, path: str) -> None:
        """Add path to serve static files.

        ``prefix`` is used for url prefix to serve static files and ``path`` is
        a path to the static file directory. ``prefix = '/_static'`` is
        reserved for the server, so do not use it for your app.
        """
        pattern = prefix
        if not pattern.startswith('/'):
            pattern = '/' + pattern
        if not pattern.endswith('/(.*)'):
            pattern = pattern + '/(.*)'
        self.add_handlers(
            r'.*',  # add static path for all virtual host
            [(pattern, StaticFileHandler, dict(path=path))]
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号