Skip to main content

Serve multiple Textual apps

Project description

ganglion

Ganglion is an application which serves Textual apps on the web.

Compatibility

Tested on Linux / macOS. It may well run on Windows, but this is as yet untested.

Installing

Ganglion is best installed as a standalone app.

The easiest way of doing this is with uv:

uv tool install ganglion

You should find the ganglion command on your path. Confirm the installation was successful by running:

ganglion

Setting up the database

Run the following to create a database:

ganglion initdb

This will create a sqllite database "ganglion.db" in the current directory.

Serving

To run a Ganglion server, enter the following command:

ganglion serve

You can also add DEBUG=1 when running locally to see prettier and more verbose logs:

DEBUG=1 ganglion serve

You can run a test client (for debugging) with the following command:

ganglion client

Clients

To serve a Textual web app or apps install textual-web. Follow the instructions on the textual-web repository to run apps, but add -e local to connect to a local server.

For example, so serve the Textual demo you could run the following:

textual-web -r "python -m textual" -e local

Configuration

You can configure Ganglion via a TOML configuration file. The path to this configuration file may be set in the env var GANGLION_CONFIG, or with the --config in the serve command (and others).

Here's the default, internal configuration:

[server]
# The base URL where ganglion serves from
base_url = "http://127.0.0.1:8080"
# The URL for applications
app_url_format = "http://127.0.0.1:8080/{account}/{application}"
# The websocket URL where applications are served from
app_websocket_url = "ws://127.0.0.1:8080"

[templates]
# Root directory for templates
root = "${GANGLION_DATA}/templates"

[static]
# Local directory where static assets are contained
root = "${GANGLION_DATA}/static"
# URL where static assets are served from
url = "/static/"

[db]
# sqlalchemy async database URL
url = "sqlite+aiosqlite:///./ganglion.db"
# Consider Postgres for production
#url = "postgresql+asyncpg://postgres:password@localhost/ganglion"

If you want to edit this configuration, copy it to "ganglion.toml" and run with the following command:

GANGLION_CONFIG=./ganglion.toml ganglion serve 

Alternatively, use the --config switch to set the configuration path:

ganglion serve --config ./ganglion.toml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ganglion-0.1.1.tar.gz (346.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ganglion-0.1.1-py3-none-any.whl (264.0 kB view details)

Uploaded Python 3

File details

Details for the file ganglion-0.1.1.tar.gz.

File metadata

  • Download URL: ganglion-0.1.1.tar.gz
  • Upload date:
  • Size: 346.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for ganglion-0.1.1.tar.gz
Algorithm Hash digest
SHA256 490b26e0684c0e4f6d9f593f1fd031e9a14efca50c6c7d3220136f8f4007ca29
MD5 fac27e38a2b16ab9186f19a52c1daf41
BLAKE2b-256 94a1889683fc099aad473d7f82623b512f0f1f6a74274f463ce85bbcf31de077

See more details on using hashes here.

File details

Details for the file ganglion-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ganglion-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 264.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for ganglion-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2daef07798be208e5044d1ada36a8a97b69d0e8c46b6576bb7682d6b1c566945
MD5 7d47f96240e68eecd6d13f0629fc26a3
BLAKE2b-256 f19481abb5c98387d5dbb90e386b959b63ba0e1501fe76d33e44d3d676033453

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page