diff --git a/marimo/_config/config.py b/marimo/_config/config.py
index f99fc1846da..b04f0added5 100644
--- a/marimo/_config/config.py
+++ b/marimo/_config/config.py
@@ -121,9 +121,12 @@ class ServerConfig(TypedDict):
- `browser`: the web browser to use. `"default"` or a browser registered
with Python's webbrowser module (eg, `"firefox"` or `"chrome"`)
+ - `follow_symlink`: if true, the server will follow symlinks it finds
+ inside its static assets directory.
"""
browser: Union[Literal["default"], str]
+ follow_symlink: bool
class PackageManagementConfig(TypedDict):
@@ -199,7 +202,10 @@ class MarimoConfig(TypedDict):
"format_on_save": False,
},
"package_management": {"manager": "pip"},
- "server": {"browser": "default"},
+ "server": {
+ "browser": "default",
+ "follow_symlink": False,
+ },
}
diff --git a/marimo/_server/api/endpoints/assets.py b/marimo/_server/api/endpoints/assets.py
index 35e0147181c..44d1cbfa0af 100644
--- a/marimo/_server/api/endpoints/assets.py
+++ b/marimo/_server/api/endpoints/assets.py
@@ -11,6 +11,7 @@
from starlette.staticfiles import StaticFiles
from marimo import _loggers
+from marimo._config.manager import UserConfigManager
from marimo._runtime.virtual_file import EMPTY_VIRTUAL_FILE, read_virtual_file
from marimo._server.api.deps import AppState
from marimo._server.router import APIRouter
@@ -31,9 +32,14 @@
# Root directory for static assets
root = os.path.realpath(str(import_files("marimo").joinpath("_static")))
+config = UserConfigManager().get_config().get("server", {})
+
router.mount(
"/assets",
- app=StaticFiles(directory=os.path.join(root, "assets")),
+ app=StaticFiles(
+ directory=os.path.join(root, "assets"),
+ follow_symlink=config.get("follow_symlink", False),
+ ),
name="assets",
)
diff --git a/tests/_server/templates/snapshots/export1.txt b/tests/_server/templates/snapshots/export1.txt
index 8ec77be19aa..bab697f43be 100644
--- a/tests/_server/templates/snapshots/export1.txt
+++ b/tests/_server/templates/snapshots/export1.txt
@@ -56,7 +56,7 @@