Installation

Lila Framework v2.0.0 requires Python 3.10+ (Starlette 1.x and Uvicorn 0.54 need it). Optional extras: [redis], [images], [markdown], [metrics], [optimize] and [desktop].

Install
$python -m venv venv
$source venv/bin/activate # On Windows, `venv\Scripts\activate`
$pip install lila-framework
$lila init
$lila dev

Build-Free Styling

Lila ships a zero-dependency, build-free styling system: no Node.js, Vite or npm step is required to get started.

  • Tailwind Play CDN: Development templates load the Tailwind Play CDN script, so utility classes work immediately. Google Fonts are not loaded by Lila; the bundled layouts use the system font stack.
  • Production: the Play CDN is a development convenience. For production the README recommends shipping a precompiled CSS file and pointing public('css/tailwind.css') at it.
  • Custom Component Layer: the bundled component classes (cards, inputs, buttons, layouts) support light and dark mode out of the box.
  • Customization & Removal: edit your layout at resources/html/lila/base.jinja and change or remove the {{ asset('css/tailwind.css') | safe }} call.

️ Application Configuration

Purpose: Configure and start the application. main.py is the main entry point where the application is configured and initialized.

Zero-Disk I/O Configuration

Lila is built with maximum performance in mind. Reading from disk on every request is a known bottleneck. Lila caches environment variables and in-memory locales directly at CPython speeds with zero request overhead.

main.py

from app.config import DEBUG, HOST, PORT, WORKERS
from app.routes.web.index import router as web_router
from app.routes.api.index import router as api_router
from lila.core.app import App

# api_marker
# auth_marker
# admin_marker

# Initialize Lila application with optional batteries
app = App(
    routes=[web_router, api_router],
    debug=DEBUG,          # bool, not a string
    security=True,        # Security headers & path traversal shield
    rate_limit=300,       # 300 req/min per IP (None to disable)
    logging=False,        # True to log requests in app/logs/YYYY-MM-DD/
    cors=True,            # Credentials are OFF by default
    gzip=True,
    openapi=True,         # Mounts /openapi.json and Swagger UI at /docs
    debug_html=DEBUG,     # Mounts GET/DELETE /debug in debug mode
)
            

Run the production server with lila run -w 2; the CLI reads HOST/PORT from .env and warns when more than one worker is combined with the in-memory cache.