Base Settings

Smarter base settings module, shared by all environments.

This module provides the base Django settings for all Smarter environments. For strongly-typed, project-specific settings overrides, see smarter_settings.

Notes:

smarter.settings.base.ALLOWED_HOSTS = ['.api.localhost', '.api.localhost:9357', 'api.localhost', 'api.localhost:9357', 'localhost', 'localhost:9357', 'testserver']

A list of strings representing the host/domain names that this Django site can serve.

Smarter implements its own middleware to validate host names. See smarter.apps.llmclient.middleware.security.SmarterSecurityMiddleware.

See:

[
    '.api.localhost',
    '.api.localhost:9357',
    'api.localhost',
    'api.localhost:9357',
    'localhost',
    'localhost:9357',
    'testserver',
]
smarter.settings.base.AUTHENTICATION_BACKENDS = ['social_core.backends.google.GoogleOAuth2', 'social_core.backends.github.GithubOAuth2', 'django.contrib.auth.backends.ModelBackend']

The authentication backends for Smarter, including social authentication.

Google’s and GitHub’s, and Django’s model backend. Smarter additionally implements its own key-based REST API authentication backend.

A deployment overrides them with DJANGO_AUTHENTICATION_BACKENDS, comma-separated, e.g. the multitenant backends in smarter.lib.social_core.backends.multitenant (see smarter.settings.overrides).

See:

[
    'social_core.backends.google.GoogleOAuth2',
    'social_core.backends.github.GithubOAuth2',
    'django.contrib.auth.backends.ModelBackend',
]
smarter.settings.base.AUTH_PASSWORD_VALIDATORS = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}]

The password validation settings for Smarter, using Django’s built-in.

password validators. These validators help ensure that user passwords meet minimum security requirements. These rules should be sufficient for most use cases, but can be customized as needed.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators

[
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]
smarter.settings.base.AWS_ACCESS_KEY_ID = None

Supplemental setting for configuring AWS support.

The AWS access key ID is retrieved and validated in smarter_settings.

For production deployments the chain of custody should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django AWS_ACCESS_KEY_ID.

See: smarter_settings.aws_access_key_id

smarter.settings.base.AWS_QUERYSTRING_AUTH = False

Supplemental setting for configuring AWS S3 storage support.

Disables querystring authentication for public files in favor of public-read ACL that is configured in the Smarter Terraform scripts.

See:

smarter.settings.base.AWS_S3_REGION_NAME = None

Supplemental setting for configuring AWS support.

The AWS region is retrieved and validated in smarter_settings.

See:

  • smarter_settings.aws_region

smarter.settings.base.AWS_SECRET_ACCESS_KEY = None

Supplemental setting for configuring AWS support.

The AWS secret access key is retrieved and validated in smarter_settings.

For production deployments the chain of custody should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django AWS_SECRET_ACCESS_KEY.

See: smarter_settings.aws_secret_access_key

smarter.settings.base.AWS_STORAGE_BUCKET_NAME = 'local.smarter.sh'

Supplemental setting for configuring AWS S3 storage support.

The S3 bucket name is derived in smarter_settings.

See:

  • smarter_settings.aws_s3_bucket_name

smarter.settings.base.CACHES = {'default': {'BACKEND': 'django_redis.cache.RedisCache', 'KEY_PREFIX': 'django6.0.10', 'LOCATION': 'redis://:smarter@smarter-redis:6379/1', 'OPTIONS': {'CLIENT_CLASS': 'django_redis.client.DefaultClient', 'CONNECTION_POOL_KWARGS': {'health_check_interval': 25, 'socket_keepalive': True}, 'SOCKET_CONNECT_TIMEOUT': 2, 'SOCKET_TIMEOUT': 5}}, 'sessions': {'BACKEND': 'django_redis.cache.RedisCache', 'LOCATION': 'redis://:smarter@smarter-redis:6379/2', 'OPTIONS': {'CLIENT_CLASS': 'django_redis.client.DefaultClient', 'CONNECTION_POOL_KWARGS': {'health_check_interval': 25, 'socket_keepalive': True}, 'SOCKET_CONNECT_TIMEOUT': 2, 'SOCKET_TIMEOUT': 5}}}

The Django cache configuration for Smarter, using Redis as the cache backend.

default holds the application’s cached objects, in Redis database 1. sessions holds user sessions, in database 2 of the same server, so that cache.clear(), e.g. from manage.py reset_cache, doesn’t log anyone out. See SESSION_CACHE_ALIAS.

See:

{
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'KEY_PREFIX': 'django6.0.10',
        'LOCATION': 'redis://:smarter@smarter-redis:6379/1',
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient',
            'CONNECTION_POOL_KWARGS': {
                'health_check_interval': 25,
                'socket_keepalive': True,
            },
            'SOCKET_CONNECT_TIMEOUT': 2,
            'SOCKET_TIMEOUT': 5,
        },
    },
    'sessions': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://:smarter@smarter-redis:6379/2',
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient',
            'CONNECTION_POOL_KWARGS': {
                'health_check_interval': 25,
                'socket_keepalive': True,
            },
            'SOCKET_CONNECT_TIMEOUT': 2,
            'SOCKET_TIMEOUT': 5,
        },
    },
}
smarter.settings.base.CACHE_KEY_PREFIX = 'django6.0.10'

The KEY_PREFIX of the default cache, e.g. django6.0.10.

The cache pickles model instances (@cache_results, waffle), and Django only promises that a pickled model instance can be loaded by the Django version that pickled it. During a rolling update, pods on the old and the new Django version share one Redis, so without this prefix each would load the other’s instances. With it, a Django upgrade starts with a cold cache. The sessions cache has no prefix, so that an upgrade doesn’t log anyone out: sessions hold no model instances.

smarter.settings.base.CACHE_OPTIONS = {'CLIENT_CLASS': 'django_redis.client.DefaultClient', 'CONNECTION_POOL_KWARGS': {'health_check_interval': 25, 'socket_keepalive': True}, 'SOCKET_CONNECT_TIMEOUT': 2, 'SOCKET_TIMEOUT': 5}

The OPTIONS of the Redis cache in every environment.

CONNECTION_POOL_KWARGS makes each pooled connection survive a Redis restart: a health check before an idle connection is reused (see REDIS_HEALTH_CHECK_INTERVAL), and TCP keepalive, so that the kernel notices a connection whose server vanished without closing it.

{
    'CLIENT_CLASS': 'django_redis.client.DefaultClient',
    'CONNECTION_POOL_KWARGS': {
        'health_check_interval': 25,
        'socket_keepalive': True,
    },
    'SOCKET_CONNECT_TIMEOUT': 2,
    'SOCKET_TIMEOUT': 5,
}
smarter.settings.base.CACHE_RESULTS = {'CACHE_ALIAS': 'default', 'KEY_ENCODER': 'smarter.lib.cache.hooks.SmarterCacheKeyEncoder', 'LOGGING_ENABLED': 'smarter.lib.cache.hooks.logging_enabled', 'LOG_PREFIX': 'cache_results.colors.log_prefix', 'TIMEOUT': 60, 'VERBOSE_LOGGING': 'smarter.lib.cache.hooks.verbose_logging'}

The configuration of the @cache_results decorator.

Its default timeout is smarter_settings.subsystem_cache_expiration, the hooks in smarter.lib.cache.hooks connect it to the CACHE_LOGGING waffle switch and Pydantic cache key arguments, and log messages are colored by the package’s cache_results.colors.log_prefix. Every entry is described in cache_results.conf, the settings of the cache-results package.

{
    'CACHE_ALIAS': 'default',
    'KEY_ENCODER': 'smarter.lib.cache.hooks.SmarterCacheKeyEncoder',
    'LOGGING_ENABLED': 'smarter.lib.cache.hooks.logging_enabled',
    'LOG_PREFIX': 'cache_results.colors.log_prefix',
    'TIMEOUT': 60,
    'VERBOSE_LOGGING': 'smarter.lib.cache.hooks.verbose_logging',
}
smarter.settings.base.CACHE_SOCKET_CONNECT_TIMEOUT = 2

Seconds to wait to connect to Redis, the cache and session store, before the request fails.

smarter.settings.base.CACHE_SOCKET_TIMEOUT = 5

Seconds to wait for Redis to answer a command before it fails.

Without it, redis-py waits forever, so a Redis that stalls would hold every request’s thread, since every request reads its session from the cache.

smarter.settings.base.CELERY_BEAT_MAX_LOOP_INTERVAL = 30

The longest time, in seconds, that Celery Beat sleeps between two ticks.

Beat extends RedBeat’s lock once per tick, and a Beat that waits for the lock tries again after this interval. Celery’s default is 300 seconds.

See: https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-max-loop-interval

smarter.settings.base.CELERY_BROKER_TRANSPORT_OPTIONS: dict[str, int | str] = {'health_check_interval': 25, 'socket_connect_timeout': 5, 'socket_keepalive': True, 'socket_timeout': 30}

The options of Celery’s Redis transport, so that a worker notices that Redis went away, and reconnects.

A worker waits for tasks on one long-lived connection, with a blocking BRPOP. When Redis restarts on another node without closing that connection, e.g. a spot node that is reclaimed, the connection is left half-open: without a socket timeout or keepalive, the worker waits on it forever, logs nothing, and runs no task until it is restarted (issue #940). socket_timeout turns that wait into an error that kombu handles by reconnecting. It must stay above the BRPOP timeout, 1 second by default. TCP keepalive and the health check find dead connections sooner.

See: https://docs.celeryq.dev/en/stable/userguide/configuration.html#broker-transport-options

{
    'health_check_interval': 25,
    'socket_connect_timeout': 5,
    'socket_keepalive': True,
    'socket_timeout': 30,
}
smarter.settings.base.CELERY_BROKER_URL = 'redis://:smarter@smarter-redis:6379/0'

The Celery broker URL for Smarter, using Redis as the message broker.

The broker uses Redis database 0, the cache database 1 and sessions database 2. They must differ: cache.clear(), e.g. from manage.py reset_cache, runs FLUSHDB on the cache’s database, which would also delete the Celery queues and the RedBeat schedule.

See:

smarter.settings.base.CELERY_REDBEAT_LOCK_TIMEOUT = 150

The time, in seconds, that RedBeat’s lock lives unless Beat extends it.

When Beat crashes while Redis is unreachable, it can’t release its lock, and the restarted Beat waits until the lock expires. With RedBeat’s default of five times Celery’s 300-second loop interval, no periodic task ran for 25 minutes after a Redis restart (issue #964). The lock must outlast CELERY_BEAT_MAX_LOOP_INTERVAL, because Beat extends it once per tick. With one Beat replica, it only keeps two Beats from overlapping during a rollout.

See: https://redbeat.readthedocs.io/en/latest/config.html

smarter.settings.base.CELERY_REDBEAT_REDIS_OPTIONS = {'health_check_interval': 25, 'socket_connect_timeout': 5, 'socket_keepalive': True, 'socket_timeout': 30}

The options of RedBeat’s Redis connection, the scheduler of Celery Beat.

Like CELERY_BROKER_TRANSPORT_OPTIONS: after a Redis restart, Beat’s stale connection made the extension of its lock fail with Broken pipe, which crashed Beat (issue #940). The health check reconnects it first.

See: https://redbeat.readthedocs.io/en/latest/config.html

{
    'health_check_interval': 25,
    'socket_connect_timeout': 5,
    'socket_keepalive': True,
    'socket_timeout': 30,
}
smarter.settings.base.CELERY_REDBEAT_REDIS_URL = 'redis://:smarter@smarter-redis:6379/0'

the broker’s.

RedBeat 2.5.0 no longer falls back to the broker url, so it is set explicitly (issue #945). Settings modules that change CELERY_BROKER_URL set it again.

See: https://redbeat.readthedocs.io/en/latest/config.html

Type:

The Redis url of RedBeat, the scheduler of Celery Beat

smarter.settings.base.CELERY_RESULT_EXPIRES = 300

Seconds to keep a task’s result in the result backend.

The tool runner waits for its result for the tool call’s timeout, at most a few minutes, so five minutes is enough. The result backend is the broker’s Redis: see smarter.lib.celery_conf.

smarter.settings.base.CELERY_TASK_IGNORE_RESULT = True

Store no task’s result, unless the task asks to.

Only the tool runner’s task, run_tool_call, returns a result that its caller waits for (ADR-038), and it sets ignore_result=False. Every other task is fire and forget, and storing its result would only fill Redis.

smarter.settings.base.CELERY_TASK_TIME_LIMIT = 1800

30 minutes, after which Celery kills it.

It is a safety net, not a budget. No task waits by sleeping (ADR-030, rule 2): one that waits for something outside Smarter, e.g. DNS propagation, a certificate’s issue or a server’s start, checks once and queues itself again with a countdown, so that it never holds a worker process while it waits.

See: https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-task_time_limit

Type:

The longest that one run of a Celery task may take, in seconds

smarter.settings.base.CELERY_WORKER_CANCEL_LONG_RUNNING_TASKS_ON_CONNECTION_LOSS = True

Cancel running tasks with late acknowledgement when a worker loses its broker connection.

Such a task can’t be acknowledged once the connection is gone, so the broker redelivers it, and cancelling it keeps it from running twice. True is Celery 6’s default. Celery 5 warns on every lost connection while it is False, e.g. during a Redis restart. Smarter’s tasks don’t use late acknowledgement, so this changes no task’s behavior.

See: https://docs.celeryq.dev/en/stable/userguide/configuration.html#worker-cancel-long-running-tasks-on-connection-loss

smarter.settings.base.CELERY_WORKER_HIJACK_ROOT_LOGGER = False

A Celery setting that prevents Celery workers from hijacking the root logger.

This is set to False to allow Celery logs to be integrated with the overall Smarter logging configuration without interference.

See: https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-worker_hijack_root_logger

smarter.settings.base.CELERY_WORKER_PREFETCH_MULTIPLIER = 1

one, the message it is about to run.

Celery’s default is 4. A pod of 4 processes then holds up to 16 messages that have already left Redis’s list, and those reserved behind a long task wait for it, even while another pod, or a new replica, is idle. The queue’s length also stops counting them, which is the metric that #1097 scales the workers on. With 1, a message stays in Redis until a process is free to run it, so any free process of any pod takes it.

The cost is one round trip to Redis per task, which is nothing beside a task’s own work. The pool already gives a task only to an idle process: -O default is the fair strategy (SCHED_STRATEGY_FAIR) in Celery 5.

See: https://docs.celeryq.dev/en/stable/userguide/optimizing.html#prefetch-limits

Type:

How many messages each worker process reserves from its queue

smarter.settings.base.CORS_ALLOWED_ORIGINS: list[str] = ['http://127.0.0.1:3000', 'http://localhost:3000', 'http://127.0.0.1:5173', 'http://localhost:5173', 'http://127.0.0.1:9357', 'http://localhost:9357', 'http://cdn.local.smarter.sh', 'https://cdn.local.smarter.sh', 'http://localhost:9357', 'http://api.localhost:9357', 'http://cdn.local.smarter.sh', 'https://localhost:9357', 'https://api.localhost:9357', 'https://cdn.local.smarter.sh']

A list of origins that are allowed to make cross-site HTTP requests.

This is initialized here as an empty list because base_aws.py and other environment-specific settings files will append to this list based on derived settings values in smarter_settings.

See React Integration

[
    'http://127.0.0.1:3000',
    'http://localhost:3000',
    'http://127.0.0.1:5173',
    'http://localhost:5173',
    'http://127.0.0.1:9357',
    'http://localhost:9357',
    'http://cdn.local.smarter.sh',
    'https://cdn.local.smarter.sh',
    'http://localhost:9357',
    'http://api.localhost:9357',
    'http://cdn.local.smarter.sh',
    'https://localhost:9357',
    'https://api.localhost:9357',
    'https://cdn.local.smarter.sh',
]
smarter.settings.base.CORS_ALLOWED_ORIGIN_REGEXES = ['^https?://[\\w-]+\\.(\\d+-\\d+-\\d+)\\.api\\.localhost:\\d+$', '^https?://[\\w-]+\\.localhost:\\d+$', '^https?://[\\w-]\\.api\\.localhost:\\d+$']

A list of regular expressions representing the origins that are allowed to make cross-site HTTP requests.

Smarter uses this setting to restrict allowed origins for CORS requests from smarter-prompt React frontends.

See React Integration

[
    '^https?://[\\w-]+\\.(\\d+-\\d+-\\d+)\\.api\\.localhost:\\d+$',
    '^https?://[\\w-]+\\.localhost:\\d+$',
    '^https?://[\\w-]\\.api\\.localhost:\\d+$',
]
smarter.settings.base.CORS_ALLOW_ALL_ORIGINS = False

A boolean that determines whether to allow all origins to make cross-site HTTP requests.

Smarter defaults this to False and uses CORS_ALLOWED_ORIGIN_REGEXES to restrict allowed origins. See smarter.lib.django.middleware.cors.SmarterCorsMiddleware.

This affects the Access-Control-Allow-Origin header in responses to cross-site requests. It affects the behavior for smarter-prompt React frontend applications making requests to the Smarter API.

Modifications to this will require comensurate changes to the CORS headers sent by a Smarter Prompt host (e.g. AWS CloudFront distribution) to avoid CORS errors in browsers.

See React Integration

smarter.settings.base.CORS_ALLOW_CREDENTIALS = True

A boolean that determines whether to allow cookies to be included in cross-site HTTP requests.

Smarter defaults this to True to allow session cookies to be sent by smarter-prompt React frontends.

See React Integration

smarter.settings.base.CORS_ALLOW_HEADERS = ['accept', 'authorization', 'content-type', 'user-agent', 'x-csrftoken', 'x-requested-with', 'x-api-key', 'accept-encoding', 'dnt', 'origin', 'x-smarter-client', 'x-smarter-clientversion', 'x-smarter-clienttype', 'x-smarter-requestid', 'x-smarter-capabilities']

A list of non-standard HTTP headers that are allowed in cross-site HTTP requests.

Smarter Prompt frontends pass the Smarter API key in the ‘x-api-key’ header.

See React Integration

[
    'accept',
    'authorization',
    'content-type',
    'user-agent',
    'x-csrftoken',
    'x-requested-with',
    'x-api-key',
    'accept-encoding',
    'dnt',
    'origin',
    'x-smarter-client',
    'x-smarter-clientversion',
    'x-smarter-clienttype',
    'x-smarter-requestid',
    'x-smarter-capabilities',
]
smarter.settings.base.CSP_API_SOURCES: list[str] = ['api.localhost:9357', '*.api.localhost:9357']

The environment’s api host and its subdomains, which a deployed LLMClient’s chat calls.

['api.localhost:9357', '*.api.localhost:9357']
smarter.settings.base.CSP_JSDELIVR = 'https://cdn.jsdelivr.net'

The CDN that the console’s code editor (Monaco) loads from.

smarter.settings.base.CSP_REPORT_URL = 'http://localhost:9357/csp-report/'

smarter.lib.django.csp.CspReportView, on the platform’s.

host, so that a page on a deployed LLMClient’s host reports there too.

Type:

Where browsers send violation reports

smarter.settings.base.CSP_STATIC_SOURCES: list[str] = []

'self' covers /static/.

[]
Type:

The origin of STATIC_URL while the static files are on the CDN, else nothing

The age of the CSRF cookie, in seconds.

Default is 60 * 60 * 24 (1 day). This is a placeholder for Smarter-specific functionality in smarter.lib.django.middleware.csrf.SmarterCsrfViewMiddleware. The default value should be sufficient for most use cases, unless your use case involves e-commerce checkouts that need a shorter CSRF token lifetime.

See:

The domain to use for the CSRF cookie.

This is set to the Smarter platform domain derived from smarter_settings.

See:

A boolean that determines whether the CSRF cookie should be marked as “HttpOnly”.

Default is False because the smarter-prompt React frontend needs to read the CSRF cookie value via JavaScript to include it in the ‘X-CSRFToken’ header of HTTP requests.

See:

The name of the CSRF cookie.

Default is ‘csrftoken’. This is a placeholder for Smarter-specific functionality in smarter.lib.django.middleware.csrf.SmarterCsrfViewMiddleware.

See:

The path to use for the CSRF cookie.

Default is ‘/’.

See:

The value for the SameSite flag on the CSRF cookie.

Default is ‘Lax’. Smarters needs this to be ‘Lax’ to support cross-site requests from smarter-prompt React frontends.

See:

A boolean that determines whether the CSRF cookie should be marked as “secure”.

False here, for local development over plain http://localhost, where a browser would drop a secure cookie. smarter.settings.base_aws sets it to True.

A proxy that terminates TLS doesn’t get in the way. Django adds the Secure attribute to the cookie whether or not it sees the request as secure, and the browser enforces it against the url it loaded, which is https://. The web console’s JavaScript can still read the cookie: Secure only keeps it off plain HTTP connections.

See:

smarter.settings.base.CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'

The name of the HTTP header that carries the CSRF token value.

Default is ‘HTTP_X_CSRFTOKEN’, which corresponds to the ‘X-CSRFToken’ header sent by smarter-prompt React frontends.

See:

smarter.settings.base.CSRF_TRUSTED_ORIGINS = ['localhost:9357', 'api.localhost:9357']

A list of trusted origins for cross-site request forgery protection.

This is initialized here with the Smarter platform and API domains derived from smarter_settings.

See:

['localhost:9357', 'api.localhost:9357']
smarter.settings.base.CSRF_USE_SESSIONS = False

A boolean that determines whether to store the CSRF token in the user session instead of.

a cookie. Default is False because smarter-prompt React frontends rely on the CSRF cookie.

See:

smarter.settings.base.DATABASES: dict[str, dict[str, Any]] = {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_HEALTH_CHECKS': False, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.mysql', 'HOST': 'smarter-mariadb', 'NAME': 'smarter', 'OPTIONS': {'charset': 'utf8mb4', 'connect_timeout': 5}, 'PASSWORD': 'smarter', 'PORT': '3306', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'smarter'}}

The Django database configuration for Smarter, using MariaDB as the database backend.

Smarter should be able to support other common Sql databases supported by Django with minimal or no changes, but MariaDB is the recommended and tested database backend.

Every value comes from smarter_settings: SMARTER_SUBSYSTEM_SQL_HOST, SMARTER_SUBSYSTEM_SQL_PORT, SMARTER_SUBSYSTEM_SQL_DATABASE, SMARTER_SUBSYSTEM_SQL_USER and SMARTER_SUBSYSTEM_SQL_PASSWORD. Their defaults are docker-compose.yml’s smarter-mariadb service. Outside the local environment the password has no default.

These credentials are created for you by the Smarter Terraform scripts when deploying the Smarter platform.

For cloud deployments the chain of custody for database credentials should be:

Kubernetes Secret -> environment variable -> smarter_settings -> Django DATABASES.

See:

{
    'default': {
        'ATOMIC_REQUESTS': False,
        'AUTOCOMMIT': True,
        'CONN_HEALTH_CHECKS': False,
        'CONN_MAX_AGE': 0,
        'ENGINE': 'django.db.backends.mysql',
        'HOST': 'smarter-mariadb',
        'NAME': 'smarter',
        'OPTIONS': {'charset': 'utf8mb4', 'connect_timeout': 5},
        'PASSWORD': 'smarter',
        'PORT': '3306',
        'TEST': {
            'CHARSET': None,
            'COLLATION': None,
            'MIGRATE': True,
            'MIRROR': None,
            'NAME': None,
        },
        'TIME_ZONE': None,
        'USER': 'smarter',
    },
}
smarter.settings.base.DATABASE_CONNECT_TIMEOUT = 5

Seconds to wait to connect to the platform’s database before the request fails.

smarter.settings.base.DATABASE_OPTIONS: dict[str, str | int] = {'charset': 'utf8mb4', 'connect_timeout': 5}

The OPTIONS of the platform’s database in every environment.

A query times out only when smarter_settings.database_read_timeout is set, which the Helm chart does for the web server’s pods. Migrations and other management commands can legitimately run longer.

{'charset': 'utf8mb4', 'connect_timeout': 5}
smarter.settings.base.DEBUG = False

A boolean that turns on/off debug mode for Django.

This is retrieved from smarter_settings.debug_mode.

See:

smarter.settings.base.DEFAULT_HOST = 'platform'

The default host name for django-hosts.

This is set to the Smarter platform subdomain.

See: https://django-hosts.readthedocs.io/en/latest/

smarter.settings.base.KNOX_TOKEN_MODEL = 'knox.AuthToken'

The Django model to use for Knox authentication tokens.

Smarter uses the default.

smarter.settings.base.LANGUAGES = [('en', 'English'), ('es', 'Spanish'), ('fr', 'French'), ('pt-br', 'Brazilian Portuguese')]

The languages in which the Smarter web console is available.

English is the source language of every message, and the default. To add a language, append it here, then generate and translate its message catalogs with make i18n-messages LANGUAGE=<code>. The language menu of the web console lists every language here. The names are not translated, so each language is listed in its own name.

Spanish is translated in Latin American Spanish, under the generic es code rather than es-419. Django’s LANG_INFO has no es-419, so the language menu would describe it as es and post es back. A browser that asks for any variant of Spanish (es-MX, es-AR, es-419, es-ES) gets it, and Django’s own messages come from its es catalog.

Portuguese is Brazilian Portuguese, under Django’s regional pt-br code, whose catalogs are in locale/pt_BR. A browser that asks for pt-BR, or for any other variant of Portuguese (pt, pt-PT), gets it.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#languages

[
    ('en', 'English'),
    ('es', 'Spanish'),
    ('fr', 'French'),
    ('pt-br', 'Brazilian Portuguese'),
]
smarter.settings.base.LANGUAGE_CODE = 'en'

The default language code for Smarter.

Default is ‘en’, English, the source language of every message in the web console.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#language-code

one year.

Django’s default is None, a cookie that the browser deletes when it closes, so the web console would forget the user’s choice of language, and fall back to the browser’s. A signed-in user’s choice is also kept in their profile; see smarter.apps.account.language.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#language-cookie-age

Type:

The age of the language cookie, in seconds

smarter.settings.base.LOCALE_PATHS = [PosixPath('/home/runner/work/smarter/smarter/smarter/smarter/locale')]

Where the web console’s gettext message catalogs live.

smarter/smarter/locale/<language>/LC_MESSAGES/ holds django.po (the Django templates and Python code) and djangojs.po (the React apps, served to the browser by django.views.i18n.JavaScriptCatalog). The compiled .mo files are built from them by compilemessages and are not committed.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#locale-paths

[PosixPath('/home/runner/work/smarter/smarter/smarter/smarter/locale')]
smarter.settings.base.LOCAL_HOSTS = ['localhost', '127.0.0.1', 'localhost:9357', '127.0.0.1:9357', 'localhost:5173', 'testserver']

Supplemental list of local host/domain names that this Django site can serve.

This is specicific to Smarter and not officially part of Django settings.

See: smarter.common.conf.const.LOCAL_HOSTS

[
    'localhost',
    '127.0.0.1',
    'localhost:9357',
    '127.0.0.1:9357',
    'localhost:5173',
    'testserver',
]
smarter.settings.base.LOGGING = {'disable_existing_loggers': False, 'filters': {'access_log_query': {'()': 'smarter.lib.logging.filters.AccessLogQueryFilter'}, 'asyncio_shielded_cancel': {'()': 'smarter.lib.logging.filters.AsyncioShieldedCancelFilter'}, 'health_check': {'()': 'smarter.lib.logging.filters.HealthCheckFilter'}}, 'formatters': {'access': {'()': 'uvicorn.logging.AccessFormatter', 'datefmt': '[%Y-%m-%d %H:%M:%S]', 'fmt': '%(asctime)s %(levelname)s "%(request_line)s" %(status_code)s', 'use_colors': False}, 'standard': {'datefmt': '[%Y-%m-%d %H:%M:%S]', 'format': '%(asctime)s %(levelname)s %(message)s'}}, 'handlers': {'default': {'class': 'logging.StreamHandler', 'formatter': 'standard', 'level': 'INFO'}, 'redis': {'class': 'smarter.lib.logging.RedisLogHandler', 'formatter': 'standard', 'level': 'DEBUG'}, 'uvicorn': {'class': 'logging.StreamHandler', 'formatter': 'access', 'level': 'INFO'}}, 'loggers': {'PIL': {'level': 'WARNING', 'propagate': True}, 'amqp': {'level': 'WARNING', 'propagate': True}, 'asyncio': {'filters': ['asyncio_shielded_cancel'], 'propagate': True}, 'boto3': {'level': 'WARNING', 'propagate': True}, 'botocore': {'level': 'WARNING', 'propagate': True}, 'celery': {'level': 'INFO', 'propagate': True}, 'celery.task': {'level': 'INFO', 'propagate': True}, 'django.db.backends': {'level': 'INFO', 'propagate': True}, 'httpcore': {'level': 'WARNING', 'propagate': True}, 'httpx': {'level': 'WARNING', 'propagate': True}, 'kombu': {'level': 'WARNING', 'propagate': True}, 'langchain': {'level': 'WARNING', 'propagate': True}, 'openai': {'level': 'WARNING', 'propagate': True}, 'redis': {'level': 'WARNING', 'propagate': True}, 'urllib3': {'level': 'WARNING', 'propagate': True}, 'uvicorn.access': {'filters': ['access_log_query', 'health_check'], 'handlers': ['uvicorn'], 'level': 'INFO', 'propagate': False}, 'websockets': {'level': 'WARNING', 'propagate': True}}, 'root': {'handlers': ['default', 'redis'], 'level': 'DEBUG'}, 'version': 1}

Comprehensive logging configuration for the Smarter platform.

This dictionary configures Python’s built-in logging system for the Smarter application. It defines log formatters, handlers, filters, and loggers to control how log messages are processed and where they are sent.

Formatters

standard

Timestamp, log level and message, e.g. [2026-11-21 18:37:08] INFO smarter.apps.... Used by the default and redis handlers.

access

uvicorn’s uvicorn.logging.AccessFormatter, for the uvicorn handler: timestamp, log level, request line and status, e.g. [2026-11-21 18:37:24] INFO "POST /api/web/... HTTP/1.1" 200 OK. It leaves out the client’s address and port, which behind the ingress are the ingress’s own. It works only on uvicorn.access records.

Filters

health_check

Uses smarter.lib.logging.filters.HealthCheckFilter to suppress log entries for health check endpoints (e.g., /healthz/, /readiness/).

asyncio_shielded_cancel

Uses smarter.lib.logging.filters.AsyncioShieldedCancelFilter to suppress asyncio’s CancelledError exception in shielded future error, which a client that disconnects in the middle of a request causes under uvicorn.

access_log_query

Uses smarter.lib.logging.filters.AccessLogQueryFilter to mask the sensitive query parameters, such as a chat’s session_key, in uvicorn’s access log.

Handlers

default

Console handler (logging.StreamHandler) for standard output. Uses the ‘standard’ formatter. Log level is set by smarter_settings.log_level_name.

uvicorn

Console handler for uvicorn’s access log only. Uses the ‘access’ formatter.

redis

Custom handler (smarter.lib.logging.RedisLogHandler) for sending logs to Redis, for the web console’s log viewer and the workbench’s Server Logs tab. Uses the ‘standard’ formatter. Its level is DEBUG, whatever smarter_settings.log_level_name is: the log stream, smarter.apps.dashboard.views.terminal_emulator.api.streams.stream_user_logs(), sends DEBUG records only when they are asked for, as Smarter Chat’s Sandbox mode does, and otherwise only the records at smarter_settings.log_level_name and above.

Root Logger

Handlers: [‘default’, ‘redis’] Level: DEBUG, so that the redis handler receives DEBUG records. Each handler filters by its own level, so the console’s output is unchanged.

Loggers

asyncio

Propagates to the root logger, with the asyncio_shielded_cancel filter.

uvicorn.access

The uvicorn handler only, with the access_log_query filter, which masks a session key in the request’s query string, and the health_check filter, which drops the health check requests. Both are on the logger, not the handler, so they apply before any handler sees the record.

celery, celery.task

Both propagate to the root logger and use the same log level as the rest of the application.

boto3, botocore

WARNING. Their INFO records (Found credentials in environment variables., on every AWS client) and their DEBUG records (every request and response) say nothing an operator needs, and the root logger’s DEBUG level would otherwise send them all to the redis handler.

httpx, httpcore

WARNING. httpx logs every request at INFO (HTTP Request: POST https://... "HTTP/1.1 200 OK"), without Smarter’s origin prefix, and the LLM provider SDKs make every request through it. Smarter’s own receivers already log each provider call, with its context.

openai, langchain

WARNING. At DEBUG the openai SDK logs Request options: {...}, the whole request including the chat’s messages, which would put users’ prompts in the log that the web console streams (the SDK redacts only the API key header). Smarter’s receivers log each provider call without its content.

urllib3, kombu, amqp, websockets, PIL, redis

WARNING. Their DEBUG records (connections, Celery’s broker traffic, frames, image plugins, redis-py’s Failed to enable maintenance notifications on every connection) are noise, and the root logger’s DEBUG level would otherwise send them all to the redis handler.

django.db.backends

INFO. With DEBUG = True Django logs every SQL query at DEBUG, with its parameters.

Log Level

The log level for the console handlers, and for the celery and uvicorn.access loggers, is dynamically set by smarter_settings.log_level_name (e.g., ‘INFO’, ‘DEBUG’, ‘WARNING’). The root logger and the redis handler are always DEBUG.

References

This configuration ensures that health check requests do not clutter logs, and that logs are available both in the console and in Redis for further processing or monitoring.

{
    'disable_existing_loggers': False,
    'filters': {
        'access_log_query': {
            '()': 'smarter.lib.logging.filters.AccessLogQueryFilter',
        },
        'asyncio_shielded_cancel': {
            '()': 'smarter.lib.logging.filters.AsyncioShieldedCancelFilter',
        },
        'health_check': {
            '()': 'smarter.lib.logging.filters.HealthCheckFilter',
        },
    },
    'formatters': {
        'access': {
            '()': 'uvicorn.logging.AccessFormatter',
            'datefmt': '[%Y-%m-%d %H:%M:%S]',
            'fmt': '%(asctime)s %(levelname)s "%(request_line)s" %(status_code)s',
            'use_colors': False,
        },
        'standard': {
            'datefmt': '[%Y-%m-%d %H:%M:%S]',
            'format': '%(asctime)s %(levelname)s %(message)s',
        },
    },
    'handlers': {
        'default': {
            'class': 'logging.StreamHandler',
            'formatter': 'standard',
            'level': 'INFO',
        },
        'redis': {
            'class': 'smarter.lib.logging.RedisLogHandler',
            'formatter': 'standard',
            'level': 'DEBUG',
        },
        'uvicorn': {
            'class': 'logging.StreamHandler',
            'formatter': 'access',
            'level': 'INFO',
        },
    },
    'loggers': {
        'PIL': {'level': 'WARNING', 'propagate': True},
        'amqp': {'level': 'WARNING', 'propagate': True},
        'asyncio': {'filters': ['asyncio_shielded_cancel'], 'propagate': True},
        'boto3': {'level': 'WARNING', 'propagate': True},
        'botocore': {'level': 'WARNING', 'propagate': True},
        'celery': {'level': 'INFO', 'propagate': True},
        'celery.task': {'level': 'INFO', 'propagate': True},
        'django.db.backends': {'level': 'INFO', 'propagate': True},
        'httpcore': {'level': 'WARNING', 'propagate': True},
        'httpx': {'level': 'WARNING', 'propagate': True},
        'kombu': {'level': 'WARNING', 'propagate': True},
        'langchain': {'level': 'WARNING', 'propagate': True},
        'openai': {'level': 'WARNING', 'propagate': True},
        'redis': {'level': 'WARNING', 'propagate': True},
        'urllib3': {'level': 'WARNING', 'propagate': True},
        'uvicorn.access': {
            'filters': ['access_log_query', 'health_check'],
            'handlers': ['uvicorn'],
            'level': 'INFO',
            'propagate': False,
        },
        'websockets': {'level': 'WARNING', 'propagate': True},
    },
    'root': {'handlers': ['default', 'redis'], 'level': 'DEBUG'},
    'version': 1,
}
smarter.settings.base.LOGIN_REDIRECT_URL = '/'

The URL to redirect users to after successful login.

Default is ‘/’. Do not change this value unless you know what you are doing.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#login-redirect-url

smarter.settings.base.LOGIN_URL = '/login/'

The URL to redirect users to for login.

Default is ‘/login/’. Do not change this value unless you know what you are doing.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#login-url

smarter.settings.base.LOGOUT_REDIRECT_URL = '/'

The URL to redirect users to after logout.

Default is ‘/’. Do not change this value unless you know what you are doing.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#logout-redirect-url

smarter.settings.base.REDIS_HEALTH_CHECK_INTERVAL = 25

Seconds that a pooled Redis connection may sit idle before redis-py PINGs it, before reusing it.

When Redis restarts, e.g. when its pod moves to another node, the connections in each process’s pool still point at the old server. Without a health check, the first command on each of them fails, e.g. Error 32 while writing to socket. Broken pipe., and the request that sent it answers 500. With it, redis-py PINGs a connection that has been idle longer than this, finds that it is dead, and reconnects, so the request succeeds. The cache, the Celery broker and RedBeat use it.

smarter.settings.base.REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ['smarter.lib.drf.token_authentication.SmarterTokenAuthentication'], 'DEFAULT_PARSER_CLASSES': ['rest_framework.parsers.JSONParser', 'smarter.lib.drf.parsers.YAMLParser', 'rest_framework.parsers.FormParser', 'rest_framework.parsers.MultiPartParser'], 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated'], 'DEFAULT_THROTTLE_CLASSES': ['smarter.lib.drf.throttling.SmarterAnonRateThrottle', 'smarter.lib.drf.throttling.SmarterUserRateThrottle']}

The Django REST Framework configuration for Smarter, including default authentication classes,.

permission classes, parser classes and throttle classes. The throttle rates are smarter_settings.app_api_throttle_rate_anon and smarter_settings.app_api_throttle_rate_user. See smarter.lib.drf.throttling.

Do not change these values unless you know what you are doing. Even then, it’s probably a bad idea.

See: https://www.django-rest-framework.org/api-guide/settings/

{
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'smarter.lib.drf.token_authentication.SmarterTokenAuthentication',
    ],
    'DEFAULT_PARSER_CLASSES': [
        'rest_framework.parsers.JSONParser',
        'smarter.lib.drf.parsers.YAMLParser',
        'rest_framework.parsers.FormParser',
        'rest_framework.parsers.MultiPartParser',
    ],
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.IsAuthenticated',
    ],
    'DEFAULT_THROTTLE_CLASSES': [
        'smarter.lib.drf.throttling.SmarterAnonRateThrottle',
        'smarter.lib.drf.throttling.SmarterUserRateThrottle',
    ],
}
smarter.settings.base.ROOT_HOSTCONF = 'smarter.hosts'

The root host configuration module for django-hosts.

Smarter hosts multiple subdomains for platform, API, and llmclient apps. These are defined in smarter.hosts.

See: https://django-hosts.readthedocs.io/en/latest/

smarter.settings.base.ROOT_URLCONF = 'smarter.urls.console'

The root URL configuration module for Smarter.

This points to smarter.urls.console, which defines the URL patterns for the Smarter web platform console.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#root-urlconf

smarter.settings.base.SECRET_KEY = 'it94mCrwC5UdQENPmV91VMwZUcoXHKVw-gOru2S_9bA='

The secret key for this Django installation.

This is retrieved and validated from smarter_settings. If not set, a random key is generated and logged as a warning in the local environment. In every other environment, Smarter refuses to start without it. See smarter_settings.require_django_secret_key().

For production deployments the chain of custody should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SECRET_KEY.

See:

smarter.settings.base.SECURE_CSP_REPORT_ONLY = {'base-uri': [CSP.SELF], 'connect-src': [CSP.SELF, 'api.localhost:9357', '*.api.localhost:9357', 'https://cdn.jsdelivr.net', 'https://*.google-analytics.com', 'https://www.googletagmanager.com'], 'default-src': [CSP.SELF], 'font-src': [CSP.SELF, 'data:', 'https://cdn.jsdelivr.net', 'https://fonts.gstatic.com'], 'form-action': [CSP.SELF], 'img-src': [CSP.SELF, 'data:', 'blob:', 'https:'], 'object-src': [CSP.NONE], 'report-uri': ['http://localhost:9357/csp-report/'], 'script-src': [CSP.SELF, CSP.NONCE, 'https://cdn.jsdelivr.net', 'https://www.googletagmanager.com'], 'style-src': [CSP.SELF, CSP.UNSAFE_INLINE, 'https://cdn.jsdelivr.net', 'https://fonts.googleapis.com'], 'worker-src': [CSP.SELF, 'blob:']}

The Content Security Policy that Django’s ContentSecurityPolicyMiddleware sends, in report-only mode.

Browsers block nothing. They report what the policy would block to report-uri, which logs each distinct violation once an hour at WARNING (smarter.lib.django.csp). Inline scripts in the Django templates carry nonce="{{ csp_nonce }}", and the console’s page gets the same nonce (smarter.apps.dashboard.views.console_app.with_csp_nonce()). Styles keep 'unsafe-inline': React and the Bootstrap theme set inline style attributes. A view that sets its own Content-Security-Policy header, such as the doodle artwork view, keeps it. Once the reports are clean, the same dictionary moves to SECURE_CSP, which enforces it.

See: https://docs.djangoproject.com/en/6.0/ref/csp/

{
    'base-uri': [<CSP.SELF: "'self'">],
    'connect-src': [
        <CSP.SELF: "'self'">,
        'api.localhost:9357',
        '*.api.localhost:9357',
        'https://cdn.jsdelivr.net',
        'https://*.google-analytics.com',
        'https://www.googletagmanager.com',
    ],
    'default-src': [<CSP.SELF: "'self'">],
    'font-src': [
        <CSP.SELF: "'self'">,
        'data:',
        'https://cdn.jsdelivr.net',
        'https://fonts.gstatic.com',
    ],
    'form-action': [<CSP.SELF: "'self'">],
    'img-src': [<CSP.SELF: "'self'">, 'data:', 'blob:', 'https:'],
    'object-src': [<CSP.NONE: "'none'">],
    'report-uri': ['http://localhost:9357/csp-report/'],
    'script-src': [
        <CSP.SELF: "'self'">,
        <CSP.NONCE: '<CSP_NONCE_SENTINEL>'>,
        'https://cdn.jsdelivr.net',
        'https://www.googletagmanager.com',
    ],
    'style-src': [
        <CSP.SELF: "'self'">,
        <CSP.UNSAFE_INLINE: "'unsafe-inline'">,
        'https://cdn.jsdelivr.net',
        'https://fonts.googleapis.com',
    ],
    'worker-src': [<CSP.SELF: "'self'">, 'blob:'],
}
smarter.settings.base.SECURE_PROXY_SSL_HEADER: tuple[str, str] | None = None

A tuple representing a header/value combination that signifies a request is secure.

None here, for local development, where no proxy sits in front of Django. In AWS, Traefik terminates TLS and forwards plain HTTP with X-Forwarded-Proto, so smarter.settings.base_aws sets it to ("HTTP_X_FORWARDED_PROTO", "https"). Without it, request.is_secure() is always False there, and build_absolute_uri() returns http:// urls.

Set it only behind a proxy that overwrites the header: a client could otherwise send it, and make Django treat a plain HTTP request as secure.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#secure-proxy-ssl-header

smarter.settings.base.SESSION_CACHE_ALIAS = 'sessions'

its own Redis database, apart from the application’s.

cached objects, so that clearing the default cache doesn’t log users out.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#session-cache-alias

Type:

The cache that holds user sessions

The age of the session cookie, in seconds.

Default is 1209600 (2 weeks).

The domain to use for the session cookie.

This is set to the Smarter platform domain derived from smarter_settings.

See:

A boolean that determines whether the session cookie should be marked as “HttpOnly”.

True, Django’s default: the browser doesn’t let JavaScript read the session cookie, so a cross-site scripting bug can’t steal a login. The web console doesn’t read it.

See:

The name of the session cookie.

Default is ‘sessionid’. This is a placeholder for Smarter-specific functionality in smarter.apps.prompt.views.PromptWorkbenchView.

See:

The path to use for the session cookie.

Default is ‘/’. This is a placeholder.

See:

The value for the SameSite flag on the session cookie.

Default is ‘Lax’. Smarters needs this to be ‘Lax’ to support cross-site requests from smarter-prompt React frontends.

See:

A boolean that determines whether the session cookie should be marked as “secure”.

False here, for local development over plain http://localhost, where a browser would drop a secure cookie. smarter.settings.base_aws sets it to True. A proxy that terminates TLS doesn’t get in the way: see CSRF_COOKIE_SECURE.

See:

smarter.settings.base.SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

The Django session engine configuration for Smarter, using the cache backend.

(Redis) for session storage. Storing sessions in Redis will preserve user sessions across multiple web server instances in a load-balanced environment, and also insulates from sessions being lost due to redeployments or restarts of web server.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#session-engine

smarter.settings.base.SILENCED_SYSTEM_CHECKS = ['security.W001', 'security.W003', 'security.W004', 'security.W008']

Django’s system checks that Smarter silences.

security.W001 and security.W003 say that django.middleware.security.SecurityMiddleware and django.middleware.csrf.CsrfViewMiddleware aren’t in MIDDLEWARE. Django looks for those dotted paths, and Smarter installs subclasses of both instead. Django then skips the checks of the settings that they read, e.g. SECURE_HSTS_SECONDS and CSRF_COOKIE_SECURE, so smarter.lib.django.checks.check_security_middleware_subclasses() runs them, and warns when a subclass is missing.

security.W004 and security.W008 say that SECURE_HSTS_SECONDS and SECURE_SSL_REDIRECT aren’t set. In AWS, Traefik terminates TLS, redirects HTTP to HTTPS, and adds the Strict-Transport-Security header (its https-redirect and hsts middlewares, in smarter-infrastructure), in front of every host, including the deployed LLMClients and custom domains, so Django doesn’t do either again.

['security.W001', 'security.W003', 'security.W004', 'security.W008']
smarter.settings.base.SMTP_FROM_EMAIL = 'no-reply@platform.smarter.sh'

The default “from” email address for outgoing emails from Smarter.

This is derived from smarter_settings.

See:

smarter.settings.base.SMTP_HOST = None

The SMTP host for outgoing emails from Smarter.

This is derived from smarter_settings.

See:
smarter.settings.base.SMTP_PASSWORD = None

The SMTP password for outgoing emails from Smarter.

This is derived from smarter_settings. When using AWS SES as the SMTP service, this is the SMTP password generated from the AWS SES console. Note that this is NOT the AWS secret access key, nor is it the AWS IAM user password.

This credential is created for you when using the Smarter Terraform scripts to deploy the Smarter cloud platform with AWS SES as the SMTP service.

For production deployments the chain of custody should be:

Kubernetes Secret -> environment variable -> smarter_settings -> Django SMTP_PASSWORD.

See:

smarter.settings.base.SMTP_PORT = 587

The SMTP port for outgoing emails from Smarter.

This is derived from smarter_settings.

See:
smarter.settings.base.SMTP_SENDER = 'admin@smarter.sh'

The default sender email address for outgoing emails from Smarter.

This is derived from smarter_settings.

See:

smarter.settings.base.SMTP_USERNAME = None

The SMTP username for outgoing emails from Smarter.

This is derived from smarter_settings. When using AWS SES as the SMTP service, this is the SMTP password generated from the AWS SES console. Note that this is NOT the AWS secret access key, nor is it the AWS IAM user password.

This credential is created for you when using the Smarter Terraform scripts to deploy the Smarter cloud platform with AWS SES as the SMTP service.

For production deployments the chain of custody should be:

Kubernetes Secret -> environment variable -> smarter_settings -> Django SMTP_PASSWORD.

See:

smarter.settings.base.SMTP_USE_SSL = False

A boolean that specifies whether to use SSL for SMTP connections in Smarter.

This is derived from smarter_settings.

See:

smarter.settings.base.SMTP_USE_TLS = True

A boolean that specifies whether to use TLS for SMTP connections in Smarter.

This is derived from smarter_settings.

See:
smarter.settings.base.SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['username', 'first_name', 'email']

The user fields that can be searched in the Django admin interface for social authentication users.

See: https://python-social-auth.readthedocs.io/en/latest/configuration/django.html#admin-integration

['username', 'first_name', 'email']
smarter.settings.base.SOCIAL_AUTH_CREATE_USERS = False

A boolean that determines whether to automatically create user accounts.

when a user authenticates via a social authentication provider.

IMPORTANT: Smarter defaults this to False for security reasons to prevent what is effectively random virtually-anonymous user account creation via social authentication. User accounts should be created via the Smarter platform console by an administrator, then linked to social authentication providers as needed.

SETTING THIS TO TRUE IS A SECURITY AND A FINANCIAL RISK BECAUSE IT WILL ALLOW ANY USERS (E.G. BOTNETS) TO CREATE ACCOUNTS AND ACCESS PAID SERVICES WITHOUT RESTRICTION OR OVERSIGHT.

smarter.settings.base.SOCIAL_AUTH_GITHUB_KEY = 'SET-ME-PLEASE'

Python Social Auth GitHub OAuth2 client ID for Smarter.

The chain of custody for this secret should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_GITHUB_KEY.

See:

smarter.settings.base.SOCIAL_AUTH_GITHUB_SECRET = 'SET-ME-PLEASE'

Python Social Auth GitHub OAuth2 client secret for Smarter.

The chain of custody for this secret should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_GITHUB_SECRET.

See:

smarter.settings.base.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'SET-ME-PLEASE'

Python Social Auth Google OAuth2 client ID for Smarter.

The chain of custody for this secret should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_GOOGLE_OAUTH2_KEY.

See:

smarter.settings.base.SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URI = 'http://localhost:9357/social-auth/complete/google-oauth2/'

The redirect URI for Google OAuth2 social authentication in Smarter.

Do not change this value unless you know what you are doing.

See:

smarter.settings.base.SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['openid', 'email', 'profile']

The OAuth2 scopes for Google social authentication in Smarter.

See: https://python-social-auth.readthedocs.io/en/latest/backends/google.html

['openid', 'email', 'profile']
smarter.settings.base.SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'SET-ME-PLEASE'

Python Social Auth Google OAuth2 client secret for Smarter.

The chain of custody for this secret should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET.

See:

smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_EXTRA_DATA = [('id', 'id'), ('firstName', 'first_name'), ('lastName', 'last_name'), ('emailAddress', 'email_address')]

The extra data fields to retrieve from LinkedIn during social authentication in Smarter.

NOTE: (Nov-2025) LinkedIn has deprecated OAuth2 client secrets for security reasons. The Smarter reference cloud platform is no longer using LinkedIn OAuth2 for social authentication, but the configuration settings remain here for backward compatibility with existing Smarter deployments that may still be using LinkedIn OAuth2.

See: https://python-social-auth.readthedocs.io/en/latest/backends/linkedin.html

[
    ('id', 'id'),
    ('firstName', 'first_name'),
    ('lastName', 'last_name'),
    ('emailAddress', 'email_address'),
]
smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_FIELD_SELECTORS = ['id', 'first-name', 'last-name', 'email-address']

The OAuth2 field selectors for LinkedIn social authentication in Smarter.

NOTE: (Nov-2025) LinkedIn has deprecated OAuth2 client secrets for security reasons. The Smarter reference cloud platform is no longer using LinkedIn OAuth2 for social authentication, but the configuration settings remain here for backward compatibility with existing Smarter deployments that may still be using LinkedIn OAuth2.

See: https://python-social-auth.readthedocs.io/en/latest/backends/linkedin.html

['id', 'first-name', 'last-name', 'email-address']
smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = 'SET-ME-PLEASE'

Python Social Auth LinkedIn OAuth2 client ID for Smarter.

The chain of custody for this secret should be:

GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY.

See:

smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_REDIRECT_URI = 'http://localhost:9357/social-auth/complete/linkedin-oauth2/'

The redirect URI for LinkedIn OAuth2 social authentication in Smarter.

NOTE: (Nov-2025) LinkedIn has deprecated OAuth2 client secrets for security reasons. The Smarter reference cloud platform is no longer using LinkedIn OAuth2 for social authentication, but the configuration settings remain here for backward compatibility with existing Smarter deployments that may still be using LinkedIn OAuth2.

Do not change this value unless you know what you are doing.

See:

smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE = ['openid', 'profile', 'email']

The OAuth2 scopes for LinkedIn social authentication in Smarter.

NOTE: (Nov-2025) LinkedIn has deprecated OAuth2 client secrets for security reasons. The Smarter reference cloud platform is no longer using LinkedIn OAuth2 for social authentication, but the configuration settings remain here for backward compatibility with existing Smarter deployments that may still be using LinkedIn OAuth2.

See: https://python-social-auth.readthedocs.io/en/latest/backends/linkedin.html

['openid', 'profile', 'email']
smarter.settings.base.SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = 'SET-ME-PLEASE'

Python Social Auth LinkedIn OAuth2 client secret for Smarter.

NOTE: (Nov-2025) LinkedIn has deprecated OAuth2 client secrets for security reasons. The Smarter reference cloud platform is no longer using LinkedIn OAuth2 for social authentication, but the configuration settings remain here for backward compatibility with existing Smarter deployments that may still be using LinkedIn OAuth2.

The chain of custody for this secret should be: GitHub Secrets -> GitHub Actions -> environment variable -> smarter_settings -> Django SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET.

See:

smarter.settings.base.STATICFILES_DIRS = [PosixPath('/home/runner/work/smarter/smarter/smarter/smarter/static')]

A list of directories where Django will also look for static files, in addition.

to each app’s ‘static’ subdirectory. This is set to the ‘static’ directory in the BASE_DIR. This allows for global static files that are not tied to a specific app.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#staticfiles-dirs

[PosixPath('/home/runner/work/smarter/smarter/smarter/smarter/static')]
smarter.settings.base.STATIC_ROOT = PosixPath('/home/runner/work/smarter/smarter/smarter/staticfiles')

The absolute file system path to the directory where static files will be collected.

This is set to the ‘staticfiles’ directory in the project root. This directory is used by the ‘collectstatic’ management command to gather all static files from the various Django apps and store them in a single location for serving.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#static-root

smarter.settings.base.STATIC_URL = '/static/'

The URL prefix for static files in Smarter.

Default is ‘/static/’. This values needs to be consistent with the STATICFILES_DIRS and STATIC_ROOT settings, and also needs to consider how the Dockerfile file system is structured for serving static files.

Do not change this value unless you know what you are doing.

See:

smarter.settings.base.TAGGIT_CASE_INSENSITIVE = True

Whether taggit treats tags as case insensitive, e.g. “Tag” and “tag” as the same tag.

DJANGO_TAGGIT_CASE_INSENSITIVE=false turns it off (see smarter.settings.overrides).

smarter.settings.base.TAGGIT_STRIP_UNICODE_WHEN_SLUGIFYING = True

If True, strips unicode characters when slugifying tags.

smarter.settings.base.TEST_RUNNER = 'smarter.lib.unittest.runner.SmarterTestRunner'

Skips the tests tagged infrastructure, which use real Kubernetes and AWS, unless they are asked for.

smarter.settings.base.TIME_ZONE = 'UTC'

The default time zone for Smarter.

Default is ‘UTC’.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#time-zone

smarter.settings.base.USE_I18N = True

A boolean that specifies whether Django’s internationalization system.

should be enabled. Default is True. I18N support is important for Smarter to support multiple languages and locales.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#use-i18n

smarter.settings.base.USE_TZ = True

A boolean that specifies whether Django should use timezone-aware datetimes.

Default is True. Timezone support is important for Smarter to handle date and time data correctly across different time zones.

timezone-aware datetimes help ensure that timestamps are accurate and consistent regardless of the user’s location. These were released in Django 1.4 and are now standard practice for web applications.

See: https://docs.djangoproject.com/en/6.0/ref/settings/#use-tz

smarter.settings.base.WAFFLE_CREATE_MISSING_SWITCHES = True

If True, enables automatic creation of missing waffle switches in the database during deployment.

jobs. This is intended to simplify management of waffle switches in Smarter deployments.