当前位置: 首页>>代码示例>>Python>>正文


Python bottle.static_file方法代码示例

本文整理汇总了Python中bottle.static_file方法的典型用法代码示例。如果您正苦于以下问题:Python bottle.static_file方法的具体用法?Python bottle.static_file怎么用?Python bottle.static_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bottle的用法示例。


在下文中一共展示了bottle.static_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _bottle_handler

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def _bottle_handler(self):
        from bottle import static_file, request

        @self._app.get(self._uri())
        @self._app.get(self._uri(r'/'))
        def index():
            return self.doc_html

        @self._app.get(self._uri(r'/swagger.json'))
        def config_handler():
            return self.get_config(request.urlparts.netloc)

        @self._app.get(self._uri(r'/<filepath>'))
        def java_script_file(filepath):
            return static_file(filepath, root=self.static_dir)

        if self._editor:
            @self._app.get(self._uri('/editor'))
            def editor():
                return self.editor_html 
开发者ID:PWZER,项目名称:swagger-ui-py,代码行数:22,代码来源:core.py

示例2: send_image

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def send_image(filename):
    path = os.path.join(os.path.dirname(sys.argv[0]),'./resources/files/fonts' ) 
    return static_file(filename, root= path) 
开发者ID:linuxscout,项目名称:mishkal,代码行数:5,代码来源:mishkal-bootle.py

示例3: server_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_static(filename):
    if filename in ("doc", "projects", "contact", "download","index"):
        path = os.path.join(os.path.dirname(sys.argv[0]),'./resources/static/') 
        return static_file(filename+".html", root=path)
    else:
        return "<h2>Page Not found</h2>"

#------------------
# actions files
#------------------ 
开发者ID:linuxscout,项目名称:mishkal,代码行数:12,代码来源:mishkal-bootle.py

示例4: server_doku

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_doku(filepath):
    """This function serves Dokuwiki files as static text files. This is
far from being great...

    """
    filepath = filepath.lower().replace(':', '/')
    if '.' not in os.path.basename(filepath):
        filepath += '.txt'
    return static_file(filepath, root=WEB_DOKU_PATH) 
开发者ID:cea-sec,项目名称:ivre,代码行数:11,代码来源:httpd.py

示例5: server_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_static(filepath):
    """Serve the static (HTML, JS, CSS, ...) content."""
    return static_file(filepath, root=WEB_STATIC_PATH) 
开发者ID:cea-sec,项目名称:ivre,代码行数:5,代码来源:httpd.py

示例6: _static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def _static(path):
    response = None
    if 'jinja_env' in _start_args and 'jinja_templates' in _start_args:
        template_prefix = _start_args['jinja_templates'] + '/'
        if path.startswith(template_prefix):
            n = len(template_prefix)
            template = _start_args['jinja_env'].get_template(path[n:])
            response = btl.HTTPResponse(template.render())

    if response is None:
        response = btl.static_file(path, root=root_path)

    _set_response_headers(response)
    return response 
开发者ID:samuelhwilliams,项目名称:Eel,代码行数:16,代码来源:__init__.py

示例7: _get_static_file

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def _get_static_file(self, path):
        return bottle.static_file(path, self._content_root) 
开发者ID:dankilman,项目名称:awe,代码行数:4,代码来源:webserver.py

示例8: server_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_static(filename):
    return static_file(filename, root=static_dir) 
开发者ID:husseinmozannar,项目名称:SOQAL,代码行数:4,代码来源:demo_open.py

示例9: serve_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def serve_static(filename):
    return static_file(filename, root='./static') 
开发者ID:pklaus,项目名称:brother_ql_web,代码行数:4,代码来源:brother_ql_web.py

示例10: server_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_static(filepath):
    """Handler for static files, used with the development server."""
    root_folder = os.path.abspath(os.path.dirname(__file__))
    return bottle.static_file(filepath, root=os.path.join(root_folder, 'static')) 
开发者ID:microsoftgraph,项目名称:python-sample-auth,代码行数:6,代码来源:sample_graphrest.py

示例11: server_static

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def server_static(filepath):
    return static_file(filepath, root='static') 
开发者ID:felipevolpone,项目名称:ray,代码行数:4,代码来源:api.py

示例12: assets

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def assets(path):
    yield static_file(path, root=settings.STATIC_PATH) 
开发者ID:avelino,项目名称:cookiecutter-bottle,代码行数:4,代码来源:manage.py

示例13: getconfig

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def getconfig(name):
    user = auth(name)
    log("Served config for a user")
    return static_file('config.zip',
                       root=user.userdir,
                       mimetype='application/zip',
                       download='config.zip') 
开发者ID:benediktkr,项目名称:lokun-record,代码行数:9,代码来源:restapi.py

示例14: getexe

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def getexe(name):
    user = auth(name)
    log("Served exe for a user")
    return static_file('Lokun-install.exe',
                       root=user.userdir,
                       mimetype='application/octet-stream',
                       download='Lokun-install.exe') 
开发者ID:benediktkr,项目名称:lokun-record,代码行数:9,代码来源:restapi.py

示例15: rrdgraph

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import static_file [as 别名]
def rrdgraph(name):
    key_auth()
    # bottle handles 404 automatically
    return static_file(name + '_graph.png',
                       root=config.rrdroot,
                       mimetype='image/png')


# -----------------
# /callbacks
# ----------------- 
开发者ID:benediktkr,项目名称:lokun-record,代码行数:13,代码来源:restapi.py


注:本文中的bottle.static_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。