Application Settings

SmallBlock can be configured via a YAML settings file and/or environment variables.

Order of Precedence

  1. Environment variables (highest)

  2. settings.yaml in the project root

  3. Built-in defaults

Environment Variables

Common variables:

Variable

Description

DATABASE_URL

Database connection string.

DEBUG

true/false (default: false)

ALLOWED_HOSTS

Comma-separated hostnames (e.g., example.com,www.example.com).

SECRET_KEY

Random secret used for cryptographic signing.

STATIC_ROOT

Filesystem path to collected static files.

MEDIA_ROOT

Filesystem path for user uploads.

LOG_LEVEL

INFO (default), WARNING, ERROR, DEBUG.

Example .env

DEBUG=false
ALLOWED_HOSTS=smallblockcms.com
SECRET_KEY=change-me-please
DATABASE_URL=postgresql://sb_user:secure_password@localhost/smallblock
STATIC_ROOT=/srv/smallblock/static
MEDIA_ROOT=/srv/smallblock/media
LOG_LEVEL=INFO

YAML Settings (settings.yaml)

debug: false
allowed_hosts:
  - smallblockcms.com

database:
  engine: postgresql
  name: smallblock
  user: sb_user
  password: secure_password
  host: localhost
  port: 5432

paths:
  static_root: /srv/smallblock/static
  media_root: /srv/smallblock/media

Reloading Changes

  • For environment variables, restart the app service: sudo systemctl restart smallblock

  • For YAML changes, restart as well unless hot-reload is enabled in development.