mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-09-18 05:29:37 +08:00
Reimplement caching
This commit is contained in:
parent
bae2cc653e
commit
d99c82bef4
7 changed files with 89 additions and 5 deletions
|
@ -43,8 +43,10 @@ class Config(BaseModel):
|
|||
default=False,
|
||||
description="Whether to serve media files locally as oppossed to using a cloud storage solution.",
|
||||
)
|
||||
SMTP_HOST: StrictStr = Field(required=True, description="SMTP server address")
|
||||
SMTP_PORT: int = Field(default=587, description="SMTP server port (default: 587)")
|
||||
SMTP_HOST: StrictStr = Field(
|
||||
required=True, description="SMTP server address")
|
||||
SMTP_PORT: int = Field(
|
||||
default=587, description="SMTP server port (default: 587)")
|
||||
SMTP_USE_TLS: bool = Field(
|
||||
default=True, description="Whether to use TLS for SMTP connections"
|
||||
)
|
||||
|
@ -66,6 +68,18 @@ class Config(BaseModel):
|
|||
DEBUG_USER_PASSWORD: StrictStr = Field(
|
||||
required=True, description="Password for test users created during development"
|
||||
)
|
||||
CACHE_USERNAME: StrictStr = Field(
|
||||
required=True, description="Cache server authentication username"
|
||||
)
|
||||
CACHE_PASSWORD: StrictStr = Field(
|
||||
required=True, description="Cache server authentication password"
|
||||
)
|
||||
CACHE_HOST: StrictStr = Field(
|
||||
required=True, description="Server host used for caching"
|
||||
)
|
||||
CACHE_PORT: int = Field(
|
||||
required=True, description="Server port used for caching"
|
||||
)
|
||||
|
||||
@field_validator("CORS_ORIGINS", "ALLOWED_HOSTS", mode="before")
|
||||
def parse_list(cls, v):
|
||||
|
|
|
@ -242,8 +242,21 @@ SPECTACULAR_SETTINGS = {
|
|||
"SERVE_INCLUDE_SCHEMA": False,
|
||||
}
|
||||
|
||||
|
||||
# Pygraphviz
|
||||
GRAPH_MODELS = {
|
||||
"all_applications": True,
|
||||
"group_models": True,
|
||||
}
|
||||
|
||||
|
||||
# Caching
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": f"redis://{config.CACHE_USERNAME}:{config.CACHE_PASSWORD}@{config.CACHE_HOST}:{config.CACHE_PORT}/1",
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue