Configurations¶
drf-corekit is configured through the Django settings module.
Logging¶
TRANSACTION_ID_HEADER¶
Name of the HTTP header used to store and propagate the transaction identifier.
| Property | Value |
|---|---|
| Key | LOGGING.TRANSACTION_ID_HEADER |
| Type | str |
| Required | No |
| Default | "X-Transaction-ID" |
Example¶
LOG_DIR_PATH¶
Base directory used by components that write log files, such as ScriptCommand.
Generated command logs are stored under:
| Property | Value |
|---|---|
| Key | LOGGING.LOG_DIR_PATH |
| Type | str |
| Required | No |
| Default | "logs" |
Example¶
Example Output¶
Warning
LOG_DIR_PATH must not be None when using ScriptCommand.
An ImproperlyConfigured exception will be raised if a command attempts
to create execution logs without a configured log directory.
User¶
USERNAME_VALIDATORS¶
Validators applied to the username field on AbstractUser.
Supports three states:
- Key absent —
UnicodeUsernameValidatoris used (default). None— no validators are applied.- List of dotted import paths — the listed validators are instantiated and used instead.
| Property | Value |
|---|---|
| Key | USER.USERNAME_VALIDATORS |
| Type | list[str] | None |
| Required | No |
| Default | UnicodeUsernameValidator() |
Example — custom validator¶
DRF_COREKIT = {
"USER": {
"USERNAME_VALIDATORS": [
"myapp.validators.MyCustomUsernameValidator",
]
}
}
Example — no validators¶
USERNAME_MAX_LENGTH¶
Maximum character length enforced on the username field.
| Property | Value |
|---|---|
| Key | USER.USERNAME_MAX_LENGTH |
| Type | int |
| Required | No |
| Default | 150 |