Python bottle.static_file() Examples
The following are 30
code examples of bottle.static_file().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bottle
, or try the search function
.
Example #1
Source File: brother_ql_web.py From brother_ql_web with GNU General Public License v3.0 | 6 votes |
def serve_static(filename): return static_file(filename, root='./static')
Example #2
Source File: core.py From swagger-ui-py with Apache License 2.0 | 6 votes |
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
Example #3
Source File: update_server.py From ethoscope with GNU General Public License v3.0 | 5 votes |
def index(): assert_node(is_node) return bottle.static_file('index.html', root=STATIC_DIR) ########################## ## UPDATE API # All devices and node: ###########################
Example #4
Source File: wsgi_app.py From python-web-pdb with MIT License | 5 votes |
def get_static(path): return bottle.static_file(path, root=static_path)
Example #5
Source File: fakebintray.py From service-manager with Apache License 2.0 | 5 votes |
def server_static_md5(): return static_file("bintray/playtest.tgz.md5", root="./static/")
Example #6
Source File: fakeartifactory.py From service-manager with Apache License 2.0 | 5 votes |
def server_static(filepath): return static_file(filepath, root="./static/repositories")
Example #7
Source File: fakebintray.py From service-manager with Apache License 2.0 | 5 votes |
def server_static_tgz(): return static_file("bintray/playtest.tgz", root="./static/")
Example #8
Source File: dockerhub_status_image_api.py From dockerhub-build-status-image with GNU Affero General Public License v3.0 | 5 votes |
def static(): return static_file(os.path.basename(__file__), root=os.path.dirname(__file__))
Example #9
Source File: server.py From maloja with GNU General Public License v3.0 | 5 votes |
def static(name,ext): assert ext in ["ico","jpeg","jpg","png"] response = static_file(ext + "/" + name + "." + ext,root=STATICFOLDER) response.set_header("Cache-Control", "public, max-age=3600") return response
Example #10
Source File: server.py From maloja with GNU General Public License v3.0 | 5 votes |
def static(name,ext): assert ext in ["txt","ico","jpeg","jpg","png","less","js"] response = static_file(ext + "/" + name + "." + ext,root=STATICFOLDER) response.set_header("Cache-Control", "public, max-age=3600") return response
Example #11
Source File: server.py From maloja with GNU General Public License v3.0 | 5 votes |
def static_image(pth): if globalconf.USE_THUMBOR: return static_file(pthjoin("images",pth),root=DATAFOLDER) type = pth.split(".")[-1] small_pth = pth + "-small" if os.path.exists(datadir("images",small_pth)): response = static_file(pthjoin("images",small_pth),root=DATAFOLDER) else: try: from wand.image import Image img = Image(filename=datadir("images",pth)) x,y = img.size[0], img.size[1] smaller = min(x,y) if smaller > 300: ratio = 300/smaller img.resize(int(ratio*x),int(ratio*y)) img.save(filename=datadir("images",small_pth)) response = static_file(pthjoin("images",small_pth),root=DATAFOLDER) else: response = static_file(pthjoin("images",pth),root=DATAFOLDER) except: response = static_file(pthjoin("images",pth),root=DATAFOLDER) #response = static_file("images/" + pth,root="") response.set_header("Cache-Control", "public, max-age=86400") response.set_header("Content-Type", "image/" + type) return response
Example #12
Source File: apiserver.py From demobuilder with GNU General Public License v3.0 | 5 votes |
def static(path): return bottle.static_file(path, ".", "application/octet-stream")
Example #13
Source File: app.py From ldap-passwd-webui with MIT License | 5 votes |
def serve_static(filename): return static_file(filename, root=path.join(BASE_DIR, 'static'))
Example #14
Source File: app.py From PTVS-Samples with Apache License 2.0 | 5 votes |
def server_static(filepath): """Handler for static files, used with the development server. When running under a production server such as IIS or Apache, the server should be configured to serve the static files.""" return bottle.static_file(filepath, root=STATIC_ROOT) # Starts a local test server.
Example #15
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def img(filename): return static_file(filename, root="static/img")
Example #16
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def font(filename): return static_file(filename, root="static/font")
Example #17
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def css(filename): return static_file(filename, root="static/css")
Example #18
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def js(filename): return static_file(filename, root="static/js")
Example #19
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def img(filename): return static_file(filename, root="static/img")
Example #20
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def css(filename): return static_file(filename, root="static/css")
Example #21
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def js(filename): return static_file(filename, root="static/js")
Example #22
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def img(filename): return static_file(filename, root="static/img")
Example #23
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def font(filename): return static_file(filename, root="static/font")
Example #24
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def css(filename): return static_file(filename, root="static/css")
Example #25
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def img(filename): return static_file(filename, root="static/img")
Example #26
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def font(filename): return static_file(filename, root="static/font")
Example #27
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def css(filename): return static_file(filename, root="static/css")
Example #28
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def js(filename): return static_file(filename, root="static/js")
Example #29
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def img(filename): return static_file(filename, root="static/img")
Example #30
Source File: app.py From aws-servicebroker with Apache License 2.0 | 5 votes |
def css(filename): return static_file(filename, root="static/css")