當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。