Django / Production

Degrau 25 de 25

Webhooks e cache

Utilize a cache do Django para leituras rápidas de traduções locais e exponha um webhook assinado para atualizações do Altified.

Para produção, configure uma cache Django partilhada, como o Redis, para que todos os web workers leiam as mesmas traduções.

definições.py
CACHES = { "default": { "BACKEND": "django.core.cache.backends.redis.RedisCache", "LOCATION": "redis://127.0.0.1:6379", } }

Exponha o endpoint do webhook do SDK se pretender que o Altified envie as traduções concluídas de volta para a cache da aplicação.

urls.py
from django.urls import include, path urlpatterns = [ ..., path("altified/", include("django_altified.urls")), ]
  • The webhook URL is /altified/webhook/.
  • Altified signs webhook bodies with HMAC-SHA256 using the existing ALTIFIED_API_KEY.
  • The SDK stores valid webhook translations in Django cache.
  • Local memory cache is fine for development but not enough for multi-worker production.

Cabeçalho de assinatura

Os pedidos de webhook devem incluir X-Altified-Signature: sha256=<digest>A chave API em bruto nunca é enviada como token webhook.