demo

trame.app.demo.get_server(name=None, create_if_missing=True, client_type=None, **kwargs)

Return a server for serving trame applications. If a name is given and such server is not available yet, it will be created otherwise the previously created instance will be returned.

Parameters:
  • name (None | str | Server instance) – A server name identifier which can be useful when several servers are expected to be created. Most of the time, passing no arguments is what you are looking for. Also an actual Server instance can be provided so you can use it as a decorator function.

  • create_if_missing (bool) – By default if a server for a given name does not exist that method will create it.

  • client_type (None | "vue2" | "vue3") – If provided, it will set it on the server.

  • **kwargs

    any extra keyword args are passed as option to the server instance.

Returns:

Return a unique Server instance per given name.

Return type:

trame_server.core.Server

class trame.app.demo.SinglePageLayout(_server, template_name='main', **kwargs)

Bases: VAppLayout

Layout composed of the following structure:

Parameters:
  • _server – Server to bound the layout to

  • template_name – Name of the template (default: main)

<v-app id="app">
    <v-app-bar app>                     # layout.toolbar
        <v-app-bar-nav-icon />          # layout.icon
        <v-toolbar-title>               # layout.title
            Trame application
        </v-toolbar-title>
    </v-app-bar>
    <v-main />                          # layout.content
    <v-footer app class="my-0 py-0">    # layout.footer
        < ... />
    </v-footer>
</v-app>