URL Generation
When an app is mounted under a subpath (APP_BASE_PATH=/apps/progress), every link and asset URL must include that prefix. Almasix’s helpers centralize that rule.
Configuration
Section titled “Configuration”| Env / config | Role |
|---|---|
APP_URL |
Origin (https://example.com) |
APP_BASE_PATH |
Public path prefix (/apps/progress) |
The HTTP kernel mounts the ASGI app at the same prefix so smith serve matches what url() emits.
from almasix.routing import url
url("/progress")# absolute: {APP_URL}{APP_BASE_PATH}/progress# relative: url("/progress", absolute=False) → {APP_BASE_PATH}/progressAlready-absolute URLs (https://… or //…) are returned unchanged.
asset()
Section titled “asset()”Same prefixing for static files under public/:
from almasix.routing import asset
asset("css/app.css")See Asset Bundling.
redirect()
Section titled “redirect()”from almasix.http import redirect
return redirect("/progress") # path resolved through url(..., absolute=False)Named routes
Section titled “Named routes”Per-route name= is accepted on the router today. A named-route route("name", …) helper is planned (Later / router DX). Until then, prefer url("/explicit/path").
In Prism
Section titled “In Prism”Templates receive url and asset automatically:
<a href="{{ url('/progress') }}">Milestones</a><img src="{{ asset('images/almasix-banner.svg') }}" alt="Almasix">