MCPcopy Create free account
hub / github.com/datapane/datapane / mount

Method mount

python-client/src/datapane/_vendor/bottle.py:761–789  ·  view source on GitHub ↗

Mount an application (:class:`Bottle` or plain WSGI) to a specific URL prefix. Example:: parent_app.mount('/prefix/', child_app) :param prefix: path prefix or `mount-point`. :param app: an instance of :class:`Bottle` or a WSGI application.

(self, prefix, app, **options)

Source from the content-addressed store, hash-verified

759 self.add_route(route)
760
761 def mount(self, prefix, app, **options):
762 """ Mount an application (:class:`Bottle` or plain WSGI) to a specific
763 URL prefix. Example::
764
765 parent_app.mount('/prefix/', child_app)
766
767 :param prefix: path prefix or `mount-point`.
768 :param app: an instance of :class:`Bottle` or a WSGI application.
769
770 Plugins from the parent application are not applied to the routes
771 of the mounted child application. If you need plugins in the child
772 application, install them separately.
773
774 While it is possible to use path wildcards within the prefix path
775 (:class:`Bottle` childs only), it is highly discouraged.
776
777 The prefix path must end with a slash. If you want to access the
778 root of the child application via `/prefix` in addition to
779 `/prefix/`, consider adding a route with a 307 redirect to the
780 parent application.
781 """
782
783 if not prefix.startswith('/'):
784 raise ValueError("Prefix must start with '/'")
785
786 if isinstance(app, Bottle):
787 return self._mount_app(prefix, app, **options)
788 else:
789 return self._mount_wsgi(prefix, app, **options)
790
791 def merge(self, routes):
792 """ Merge the routes of another :class:`Bottle` application or a list of

Callers 1

mountReportFunction · 0.80

Calls 2

_mount_appMethod · 0.95
_mount_wsgiMethod · 0.95

Tested by

no test coverage detected