How to use the bottle.static_file function in bottle

To help you get started, we’ve selected a few bottle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inpho / topic-explorer / topicexplorer / server.py View on Github external
def description():
            filename = kwargs.get('corpus_desc')
            if not filename:
                response.status = 404
                return "File not found"
            filename = get_static_resource_path(filename)
            root, filename = os.path.split(filename)
            return static_file(filename, root=root)
github janelia-flyem / NeuTu / neurolabi / python / service / neutuse.py View on Github external
def retrieveSkeleton(bodyId):
    return static_file(str(bodyId) + '.swc',
                       root='/Users/zhaot/Work/neutube/neurolabi/data/flyem/TEM/data_release/bundle1/swc')
github pyload / pyload-webui / module / web / pyload_app.py View on Github external
@route('/')
def server_static(path):
    response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
                                                time.gmtime(time.time() + 60 * 60 * 24 * 7))
    response.headers['Cache-control'] = "public"
    resp = static_file(path, root=join(PROJECT_DIR, app_path))
    # Also serve from .tmp folder in dev mode
    if resp.status_code == 404 and app_path == "app":
        return static_file(path, root=join(PROJECT_DIR, '.tmp'))

    return resp
github microsoftgraph / python-sample-auth / sample_requests.py View on Github external
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'))
github CeON / SegmEdit / SegmServer / server.py View on Github external
@route('/:username/xmls/:id')
def xmls(username, id, db):
    doc = db.getDocument(id)
    return static_file('%s.xml' % doc.id, root=config.XMLS_DIR)
github honza / rembrant / rembrant.py View on Github external
@route('/')
def root():
    return static_file('index.html', root='./static')
github vitmalina / w2ui / server / python / bottle / app.py View on Github external
def index():
  return static_file('index.html',root=here())
github tnm / redweb / redweb / redweb.py View on Github external
def send_file(filename):
    return static_file(filename, root='../redweb/static')
github microsoftgraph / python-sample-auth / sample_graphrest.py View on Github external
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'))
github a2tm7a / SMARTHOME / Server / staticFilesForApplication.py View on Github external
def img(staticFiles) :

    return static_file(staticFiles , root="/home/pi/Desktop/SMARTHOME/html/Application/fonts")