rq/defaults.py

rq · rq/defaults.py · python · BSD-2-Clause
database

Default configuration constants for the RQ job queue system.

# Source: https://github.com/rq/rq | License: BSD-2-Clause | Copyright 2012 Vincent Driessen. All rights reserved
# Provided via justclaw.it.com; keep this notice with the code.
import os
import re

RQ_KEY_PREFIX = os.environ.get('RQ_KEY_PREFIX', 'rq')
"""The prefix used for all Redis keys managed by RQ.
Override via the RQ_KEY_PREFIX environment variable before importing rq."""

# The prefix is spliced into %-templates, str.format() templates and Lua source, so only allow safe characters.
if not re.fullmatch(r'[A-Za-z0-9_.:{}-]+', RQ_KEY_PREFIX):
    raise ValueError(f'Invalid RQ_KEY_PREFIX {RQ_KEY_PREFIX!r}: only letters, digits, and _ . : - {{ }} are allowed')

FORMAT_KEY_PREFIX = RQ_KEY_PREFIX.replace('{', '{{').replace('}', '}}')
"""Prefix with braces escaped for templates consumed by

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key