How to add serverless functions to Django in 6 minutes (using HTMX and AWS Lambda) 🧠

preview_player
Показать описание
Hi fellow Django-er 🐎

When do you use serverless functions? 

Answer: for long-running tasks (e.g., preparing PDFs, sending emails, machine learning tasks). If you don't run long-running functions outside your main server, these tasks will make your server unresponsive to new requests from users, causing a rubbish user experience.

Some people use background workers to create long-running tasks. For me, serverless functions are easier to write, simpler to test, and much easier to debug. They're also infinitely scalable (which is cool). ♾️

00:00 Overview
00:18 Section 1 - Setup Django project
01:01 Section 2 - Create Django app
02:20 Section 2 - First look at our frontend
02:24 Section 3 - Add serverless function
03:55 Section 4 - Connect our app to our serverless function
05:25 Final product 🎉
05:38 How it works
07:47 Why I use serverless functions instead of background workers
Рекомендации по теме
Комментарии
Автор

when you increased sleep to 10 or more, your app is not responding, you still need to wait from the request to serverless server. your example is only using 3secs. using celery you can fire and forget

bcomsugi
Автор

Hello, thanks for the content, is it possible to invoke the local gateway asynchronously

chideraokosa
visit shbcf.ru