ROOM1
DjangoCongress JP 2025 ROOM1の配信です!
https://djangocongress.jp/
Summary
The first section explains an application of clean or hexagonal architecture to Django. Presentation code should handle HTTP and serialization, use-case code should coordinate actions, domain code should contain business rules, and infrastructure code should handle databases and external systems. The speaker recommends keeping domain logic independent of Django models and database details, using DTOs at boundaries, and testing domain logic and use cases separately from integration and API behavior. The later section, presented by Rafael, explains why Django needs native asynchronous database support. Async can let one worker make progress on other requests while waiting for a database or external API, but Django’s current async ORM methods such as `asave()` and `aget()` are wrappers around synchronous code executed through `sync_to_async`; operations remain serialized and generally do not provide the expected performance benefits. A complete async ORM requires an async connection API, model API, and supporting layers from the server and views downward, while preserving Django’s existing synchronous APIs and compatibility with overrides and extensions. Rafael describes an emerging direction based on explicitly opened asynchronous connections and cursors, including PostgreSQL driver support and a Django pull request, while stressing that this reflects his personal view rather than an official roadmap.
Key takeaways
- Clean architecture separates presentation, use cases, domain rules, and infrastructure, keeping business logic independent of Django and database details.
- DTOs and explicit boundaries help move validated data between presentation, use-case, domain, and infrastructure layers.
- Django’s current async ORM methods usually delegate to synchronous ORM methods through `sync_to_async`, so database work is serialized and may not improve throughput.
- A genuinely asynchronous Django ORM needs native async support throughout the connection and model layers, not just async methods at the surface.
- An emerging proposal uses explicitly opened async database connections and cursors, while preserving the existing synchronous API and compatibility with extensions.
Summarised automatically from the transcript.
Chapters
- 0:00 Opening and Conference Introduction Welcome remarks, conference logistics, and an overview of the Django community event.
- 34:48 Domain-Driven Application Design Introduction to separating presentation concerns, use cases, and domain logic in Django applications.
- 40:48 Models and Serialization Discussion of keeping domain models independent from database models and handling serialization at application boundaries.
- 53:00 Clean Architecture Layers Explanation of presentation, use-case, domain, and infrastructure layers and how they depend on one another.
- 57:43 Applications and Infrastructure Examples of organizing applications, database access, internal APIs, and infrastructure dependencies.
- 1:03:00 Validation and Data Transfer Objects Using validation and DTOs to move data between presentation, use cases, domain logic, and infrastructure.
- 1:08:17 Testing the Architecture Guidance on testing domain logic, use cases, APIs, and integration points in the proposed architecture.
- 1:14:20 Architecture Discussion and Closing Final reflections on the architecture, review comments, and closing remarks.
- 1:29:42 Why Async Django Matters Rafael introduces async Django and explains the benefits of handling waiting operations concurrently.
- 1:33:00 Synchronous and Asynchronous Request Flow A weather-service example illustrates how synchronous workers wait on I/O and how async execution improves utilization.
- 1:36:51 Django’s ORM and Database Connections Overview of Django’s model and connection APIs and the stateful database operations underneath the ORM.
- 1:40:00 Concurrency Hazards in the Current ORM Why shared connection objects and transaction state make the existing connection API unsafe in asynchronous contexts.
- 1:42:12 The Async ORM Wrapper Examination of Django’s async model methods, including why methods such as asave currently serialize work.
- 1:52:09 Requirements for Native Async Django The talk outlines the need for native async server, view, model, and connection layers while preserving the sync API.
- 1:55:00 The Async Connection API Status of the proposed native async database connection API, including explicit connections, cursors, and real awaits.
Transcript
31,761 words
· auto-generated
Show
Automatically transcribed, so expect mistakes in names and technical terms.
Homiin hormoniinina.
Ah
Speaker 1: ah ah, Mike Height Damaska. Hi Yes , I must. Hi, Minasan Hayago Zayamas. Midasani o Idequite, como teorimas.
Speaker 1: Niju yom nashi de nichu go ga nigats de yu to holdano de sashi would not de kanato or moi must. But this guy Django Software Foundation, katata chimogu kyoru kita daite. Totemo , Hi, Sekai Tobito. Thanks for the essay.
Speaker 1: So it's motos, it 's not your canoe or moyamas, aligato or zayamas. That's all this. This year is the 20th anniversary of Django. Uh Saiyan Disgae, so we can say Nijun is chigat's kotoshinodis, ne? Nanto, uh, nina soldis. Swara she isn't there.
Speaker 1: Hi, eto Django Congress JP , Django Vebukre, conference. This got Kotoshua, Paison A Shinku, no nayo mo et mo. Oyo histori must, to daintadaki mas. Toda answer kikai toh taranato yko today.
Speaker 1: Yuri oko noito hiroitoni mananteuka. Nano dezehi, ichidoku, kuichidoku, kudasai, toitemo, nakanakane, ano ima hiraite, mazimeniom, tito, nakanakason na inaitomono de. Hey, Django Conference JP Well, Dary Mugakange Sare, you could take the antenna kankyode, so ho co you know conference
Speaker 1: this year. Mako no, uh no, you could an account to stay you hokey to a core stainato yukotoga. Machotzon Akanja Ctemasuy Bashotskurta Mani? Ma sankashakaotaini kei to deje motte, sankasiru, kotomutomiti mas. Ma ano okataiki mocij, nata husiti wa ke anakte, a no soita bao tskutiki ikotra tai ukotlis. Hi , Andaiva, Konoguraini, Steukimas. Eh, komata kotara konohiro kikewai, dio disko doni, e gurena
Speaker 1: kuta sai. Public viewing kaizon katamidamas. So kyo disne to kyono a public viewing kaijumas eto highshin stuff mo So no, hai changed, so tiranim kaimason de musi, eto, ma ima karate, we kirna diukata, kozirano fabric being kaijomo, a compass page mason, sochi, kosan kaitada kiribato, o moimas , Hi , Ibentonitzite, Guan Naichimas.
Speaker 1: Imamina Sanga Mitayu, Kono Haisinga , Rou Mujer. Eh, ma kono you are in and this you are in you kuna tahen date. Django congress dot jp, ni accesste , library , library, no, botanga rimas no de sochakara access. E to do michi no e chiban says notoka juzi ni jib JSD
Speaker 1: Hoskusonio Architecchaniosik They do money. But the C, but IDC, not the metam with the Camus in data. Then this kid no token you are translation here translation highly massive
Speaker 1: Sankoi to yuka. DjangoCongress, the hashtag theory must not day, Stopani , ShayHakerbato, Omoyamas. They, Chuto , Chuto, Sono open Janaitoko Hanashtaina, D Y Baiwa, Jangoja Discord, Gozaimas.
Speaker 1: Kotzerani Gosangaita Daite Congress Di Yima. Eh to Chaniruga Arimasita kto, muchato of the Hannas no anativaywa Kotsira de Machato Coco Kininatana , to core o sea tosi natuka. Soita Gimoyas Ariba ideatari, makokomo siro inatti tocolo deatta yo.
Speaker 1: You to Koro Mastach Moyero, if by gum but the kimas take them. Hi, Dewa called the Andyo Disney. Hai sinuj Hassan de Karani, Dariumas, itemasto, Jujin Jipunkara, Dareho, Scosiz, Onyo Architecchani of Setic. They do me the CSAID, Jangwa Puri got screen of katoka, fast
Speaker 1: API to you. Hi.
Speaker 1: Hi, Omata Seita Shimasta.
Speaker 2: Well, I think it's a very good thing.
Speaker 2: Hey, Shadows, King Ju Sajo, no online key , through mobility, no park like that. Take injured online de Saitan I Chinichini Sanskrit.
Speaker 2: It to DRF , Kai has to canon into the Python web framework. The nine show you can't file up front and it's a bit comic coming.
Speaker 2: Well, Sankaku stated the Mijari Mut you can there, could you no take around the unicide Masaka? Then then this kidomo. Ma nano de kidakes kunaikos today, because the kid hai kasavisu So they kinowed this gate.
Speaker 2: Say, okay , so I'll take a look at the top team. Matata, you could see Kanato Moon the skirt mood. Well, for this, Mitainakutomo, my yokaru, hanashinanukanato, umotte, orimas. The so you choose to kid this name.
Speaker 2: The musotun ho teste imarkobeso kaizen ste kutti ho markana to mutte, ne bugrava sunokosan ho senttaku shallow. We could ikone the gangakaruto, sonai takino kayak, tomatismano de la. So equal and resource more, Kaihat. No, no, no, it's also smoking because you must
Speaker 2: be mistaken. But Pfizer , the arrival in Mundaga, the night, you took more critical and study must say. Te vaatisme sono. . ma muntai monda ei tuo juttu oli maskerit muot. On a monta ega attanut kattiin No, komitsagete mimasta.
Speaker 2: Maksia, katustig , sebö nandukat sukaste ma Tato Jõudamun da ega aimasta. If you have a lot of people who are not going to be able to do this, you can't get a little bit more than a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit. The use sito use, use case, design. The TEM Gadew Model
Speaker 2: Ma War M no Katayoshimish Dimash Mungka in the Baiva Ma Django Warm Disney. If you have a lot of people who are not going to be able to do this, you can see that the same thing is that we can see that. Serialize presentation no serialize. So no database, tuna, yet.
Speaker 2: Yes, I so dono vrun ny dono kino , but be nano de presentation kinowarun deskedomo. It uh use case, uh , geomurono say you design. Logic height day. So I need to serialize a caramel to database in the access history. Nimo et use case to mean. Model ratio than DV don't access the solution on the schedule more
Speaker 2: The Sarah Nisorega do is on state a catoito. State Master. Oko ni Taiho tak, the Senkai and the skills the modelo karate pony don't say together. Stay master. Canada Zen high nature to the So no , eat yo hainko yomikir. Honday, copy, step on its screen else, mita. The kickato step hubo onajutu at
Speaker 2: the same time. Secondo buntan surmitomu and the skeleton. No, makakara mu but application.
Speaker 2: It 's name. Must be hana system. So stay Of kickup potam moral, surutameni.
Speaker 2: D be not a zembus, Izon Yoisina. Kikosono Kakunonimo, Zikanga kakarimasi , database, okay , kakun kasinto dainati. Oh, Disney. The bio to select karate, it 's the
Speaker 2: kinoto casi no kinoto, bitsketano de logic tanta decide kina imitaina. So tainat. The Matuayasono, Rozik Saiyu Stai, then Roziko Mutabia serialized out. Keso Sakide Nanika Dokaskay, Kokwaq de Henko de Kina, Mitaina Zotai, Nina Tesimaptei. Natte mustam.
Speaker 2: Kodo Katchapsurkutai or Shinki Sankak Surutokini, Kanto Siguraiva, Mazut, Doming, Tokakoto, Nagamete ,
Speaker 2: Tommy sonami más Mundai no eto kai ketzunukakini nakbaikzu made skirum. So it's the catch upon and
Speaker 2: I to you Petit application, it's appropriate, no cancer, to set no is on vaccine. Some view CDRiza kara DV took access to Kutwa teen CDIung CDRizawa view karanomi is on stemoy. Go. Be what you are there 's pie. Sangyung goni tziteva, ma so desnet, toyukan
Speaker 2: deskedomu. Okay, Kono Ichi Nino, betra application, betra cancel and success reason looking. Pizza Pnoteveno, Chocuset no, Kachikomino Kinsino, Chocse, to Yubunit Cityva, Konato , to Hanna sacita ku canato, o motteorimas. So , you know, Kritomerutamani , could be serialized, moderate, you know, geomorozic.
Speaker 2: Ma kun ka o moikite, moderniozik, no se mu kinzinisima. So stay new suit cases , or stay domain, so do you say cash maister? So the database is a very difficult time. The kickwonat
Speaker 2: is a good question. Presentation, use case. So stay DV no moderuba, motomoto no, jango, ware, no, kinovo, eto, moderu to you soni , kisaisiru to you, nari masta. The Costa Kutoniotte, etumodomaino , show yaxarite, my geomorosikumasta.
Speaker 2: Izo incom get the stimul, presentation karat, use case, use case kara, domain logic, gni, ison stake, deukasini , The core are this new o key no katamu yasaru katumon ski doma, if pan tikina union architecture no katakio stair to you. So they Yomurojic Vaku Dakinic says , Biodischi, and Kukoka database and access to Connot Dinah, Tanta Kantanikarioni.
Speaker 2: Bundy Iron Nashiru, Iron Nakino Motda, API,
Speaker 2: Kiru , Auto Montesquieu , presentation. So the chiski tatai logic tota y toca froseo, toy no kashmi, taste si ma to jutokoroga attamode , umoikite e tia you to serialize the top to seleza igainu sio chin sito yokoni facete italaki masta. So state , infrastructure , no database in the access state or state and the schedule more. Domain so cara infrastructure soon is the same. Infrastructure so cara domains on these on the other.
Speaker 2: Interface in Nomi is on the act and says. I'm not sure if you can see that I'm not sure if you can see that I'm not sure if you're not going to be able to do this. The tables has to be a good one.
Speaker 2: But Stavanakata Toshemo, so no architecture for the Kais , the Takeda Baita is entice or Hakute media, Jose, Digimister. Eto Ma omoidai, omotero in this keto, mo Sonan desgar. Ma ima zittende when you architectum. So Mito Samoyokanate, Ngakasadum Sagate, Yiruto, Shinton Deskirmu, Mamata, Sonatinaitoko.
Speaker 2: The koles I can in animas tono project took a application of this But then who possibly application? Buddies So no, do you got database?
Speaker 2: Korea, it is a microservice meta , you know, the RPC is HTTP, too, has no Ne kuna itto internal API so to you know right on that is that you must teach So say internal API can also use case in easy on the Urban Stay Master So the application. Application B cara. So no canoe application no internet revenue access to the kiva canal the infrastructure Access root to you for
Speaker 2: the infrastructure. Tono simuscassada yro to you kathi test. application sotonatsky notam any infrastructure access or infrastructure soccer access internal repeat presentation so not many use case needs Koyun iste in ta na API , use case so, kaisana , application kana access , kanarado sono application no business logic, kasaridi adimas. It's also
Speaker 2: still kutun youth , so data for so far, you know, to go take my own. Anano da Wanyo architecture kasta application ni socal access to kiva kanar kuno internet toy se kai must stop My parisono, kakurio, gas,
Speaker 2: free desimal, to no mate, no, the refu no kino skaiba, ishunde the kidunni, none dekonani toksank. No, who you know, more dishonor , fun this is a good idea. So, we have to use the data. But we have to use the infrastructure, so we 're going Etto, paridéision no tamany.
Speaker 2: Et to, Toledo Ukangaita Kekkayo Karoto, Yukutoni, Nattano de. Nadi Masta. The Itaitaita ikentus , kanga kutovaca hedi master.
Speaker 2: They my kenji tende kook, kun katacika best on gotinat line the skeleton. Makiton Nosango, Staysoni, Kaiasokotomu, Otosani, Bivuntekini , Mundaio Kaiket Surkoto, Kanato, Umotte, Olimas. Musi kuenjiten de unaziona kataio kakite, katai, kungo, kairu, kata, no munda y kaiketu samko initi to takitara, we see natu mute imas. The Kurekara no Hanashi was the application of the successor by Nidona, Mitanatokurwa, kunka in Yote Daitai, umotte y massive. Mathematics ,
Speaker 2: the first time we have to do this, and I'm going to go to the first time. to crony not the you don't know the to ma congo this name but application take them only on your set of the orimas the what A Tarasukon is it's a karaku neon that's curu kutoka dictano de an daniosati kut to yod move, says get the must yakutoka tiki and the skeleton. My ema so that I was taking study meeting a cutoshi night again. Inode , no hoga monsoon naindo taka naikanato, motto ident deskere mota eto kunkay, union textani, yo setaputonio te radita meritoto
Speaker 2: moto, mamada humpona joda inu Application drawing to mutte body mass. So you look at the disney. Kosito the Kyrika Togo Lemasta.
Speaker 1: Ariat Uzai Masta Ariatoko Zai Mas Hi, dewa desane, eto, itch you go madari masan, machato yukri, uh no it's a montai m to ste kitainato omoimas, eto e you to comment to de Ah, minosa hakusha rigato. Sono by un cododo di questo nodeta siriara di B non nagare donoyo nakanzini da rimasca dono kotodes. I
Speaker 2: got to must have saved the kutskate or as ne. Dequestono validation, atiting a validation, that it 's a response, attaite in a validation, no means , you must. Scutta validation salad data, use case in a task to kini, it is a DTO , data tense object , then hasande data lookata y must. This is also use case on the question in the ticket, data kakakosarite, et to the domain logic, so
Speaker 2: could use case in the model, ticket, so could infrastructure. Nakani data canary to infrastructure. So, modelo ni ezukas metin nakatachi. No, nagareni, notemos. The modern gay castatu are responsible to move the schedule. They so realize our vision is to or more seriously , but we're going to be able to do it. Ataga, chimate validation mosaic vendor.
Speaker 1: Ariatosaimas Ariato Zayimas Ano, hokanimo, go sumare vazihidon, commentorant tokari kaiti, talk about , oito, watakhskara, eto hitotze. Ah, I know Sakino. Kono ima unio architecture state tokology omoslukata deskasonovai do testto kaite ilukato, etwa kizon no ko test to karatoa tekosteikun kanati to kara kini natalno de oceakasai.
Speaker 2: Hi, Aligatuzai must.
Speaker 1: Hi, so this
Speaker 2: It to test on its domains or use cases , depending on the test, and then we have to use the test. Domain so then then database access to the keyboard.
Speaker 2: The use case nitsuitiva called in a skeleton. So I must see it. So this had a high tea to Kapunisimo.
Speaker 2: Anoiru Serifodotto. Katacide et API or Tataku test to this name. The sidewoni et to happy pastekina itivan taxano.
Speaker 2: Fantastic, standard , or integration test of the person of coastal cases, and the other, to you, cocoa keo stay or the must.
Speaker 1: Yeah, we check just to Arimasta. It 's the UK, eh?
Speaker 1: Hi, adiatoimas, kudasankara, motomotoso taste nice so. So
Speaker 2: no, the fact that you stay to Oseratori, sonosoni, kosa se facutamita monoga, hasis the master, the Taihan Natokurua, Yahari, Sono Motomoto serializado, kinoni, zon state caso. Ka eto hagas tamini. Tono sidiaraiza no bendikino that tri to ka bino bendikino, ida isamita inamono kami simala equals.
Speaker 2: Kiridastakara keštei kaduka dihana gasioni muzukasi i to kologa adimaste, ma ima kiridaste kedaste, motonet, mutonet and koste okay, ku sorozur, keste testoste, de no criticai. And initially in the skill to move.
Speaker 1: Hi, are you at over the master can kiss noise, eh? Sounds so skinny nice.
Speaker 2: Tata Sono no Kostelto, take easy mentality to caritistomotira, coach no co tetahony, don't sit the known hencoin, that's the quite a bit of a
Speaker 1: Eto e nibesankara, eto on architecture, sreidonohan. Koyu monodayom itana sitsumovasai. But Tamun anoxim toarimasamon ne, tamun se hanas do tomuze, sanko, ali maska, tonokodis.
Speaker 2: And then we're going to do it. physica science on your must be architecture no chocolate
Speaker 1: Hi, Ariga to Zayamas Communication. Hi, Ari Gato Wasimasu. One chance moy ku ikiru kanatu yu kiwashti masaga. Mizika menino yasiva. Hi Tajuskan eh
Speaker 1: So Jacuto Ano Saigo atasikara kitoku can a patunanda. Nankazo mitanako, duro mitanokite, umyo stay inukka.
Speaker 2: Anaka, Naniga business logic, Nanyiga Frono say you nanoca , just sino to coro kickwai not to Koroga, I don't know de Koreva eto, review not to mo it a dietary to ka coreva Kutchinanja skamita and a gironga, kek kosai no, hasse shiga chidishta. Sumozani, Mario Natikan deskedos.
Speaker 1: Now we are gathered. Tokolo you se keno see so mitanette de the sign of young to scondicunter to colour chiva mozakasika moon disga some henotchenga kill kikete honton you got to this Аригатова за масштаб. A sink Django wall in a took tanda. Do you eh?
Speaker 1: Hi, Minasan Omata Sei Tashima Sta. It's Gino Tokua.
Speaker 3: Thank you. Okay. So yeah, let's get started. So the async Django RM, where is it? It's not here yet. So what's going on? I need to start this off with a bit of a disclaimer. So following is my personal opinion. What happens? From now with Django could be completely different from what I'm about to say. And there's no formal roadmap about what's happening. But I think some of this stuff is going to look very close to what's happening. So who am I? So uh my name is Rafael. Uh I'm uh
Speaker 3: I've been a Django user for about a for a little more over a decade now. Uh I used to live in Tokyo and so would be going to the uh uh python mini hackathons from time to time. Uh usually through work, I had to deal with a lot of migration issues in particular. So uh managepy optimized migration is me. And I've also sent it, I usually send in bug fixes. But recently I have been focusing a little bit on how to move forward with async stuff. First, I want to talk a little bit about why we even care about async. io in Django, why it's kind of exciting. The main reason you we care about async, at least you know, in Django , Is
Speaker 3: that a lot of times in Django, we're waiting for other services to do things. We're waiting for a database to do something, waiting for a third-party API to do something, waiting for a user to upload a file. So during that process, while we are waiting, we want to be working. We don't want our CP our computers to just sit there and do nothing. So in that process, if we can get async AIO to work well, we'll be able to do more requests with a single web worker. So it'll be cheaper to run. It'll be faster. Yeah. And sometimes, you know, you get less latency. Sometimes. So it's a good experience, better experience for the user and cheaper to run.
Speaker 3: And sometimes easier to understand as well. A real simple example is the uh is something like this. Imagine you have a weather view where the user sends in a location. And we reach out to a third-party AP uh weather service. So you know maybe maybe we're reaching out to like Yahoo weather or something. And we make an API call. And maybe there's also a cache there. So if multiple people are asking for the weather in like Tokyo, then maybe we don't have to make the API call directly. In a world without async , without HGI, um what happens is we do
Speaker 3: requests one at a time. Our first request will come in. We'll maybe deal stuff with like middleware. We'll run our I. O. So here for example, you know, we make a call out to Yahoo. I'm not sure if they have an API or not, but let's say they do. And then you know we get a reply back. And you know, this might take 10 milliseconds, it might take 500, it might take five seconds Meanwhile, if the same worker gets another request , well it waits. Can't really do anything. Our system is busy waiting for I. O. And only whenever the first request finishes do we actually get to start processing the second one.
Speaker 3: And so for example, in our second request, we get to the I. O. block where we call out, come back. And then when that one comes in, maybe we had a third request. And here, maybe it's a cache. And so here, maybe you know we have this block here, but it's really fast. But it still had to wait for all these slow requests to get finished first. So needless to say, this is a lot of waiting for users and just, you know, when we're saying we're busy with I. O. we're not actually busy, we're just waiting. So in the world with async, where it gets a bit interesting. Now, exactly how the uh flow control ends up working, it's very dependent on many things. But To give a rough idea, with
Speaker 3: an async stack, the instant I do some AIO in a request, in this first request, I say, okay, well I'm going to be waiting for a while, so do something else So while this I. O. block is happening and we're just waiting for the response, we start operating on the next request. So we go here. And then request two starts up moving forward. And then it might reach a point where it says, oh, okay, I'm gonna make a request and wait. I'm gonna call up to this API and wait. So here again, will I wait? And this third request. Now maybe this third request is cached, maybe it's not cached, but in the case it is cached. Now in the in the example I showed we have this await call.
Speaker 3: So here we might still actually say, okay, well, we're gonna await and find some other work to do. If you're smart about it, you can even actually skip this step and maybe say, oh, that the cache is going to be fast. Let's not even await. Let's go quickly. But here, we await. And at that point, we're like, oh, okay, well, there's not really anybody else waiting. So we kind of wait for a while. And then maybe the first request. uh went through. At that point, we come back to the top and we say, oh okay, we're done, we're done with our I. O. in request one. So let's uh move forward. We move forward and then we just kind of complete. Now these requests Might or might not involve a bit more waiting than if they were being handled individually, especially for the first one. But overall, we're gonna spend less time
Speaker 3: per requests. Users are gonna get on average better response times And uh yeah, the core idea here, if you look at these graphs, if you think about all your requests happening uh at once, is that in this in this block here, In that area there, we're basically waiting for multiple things at the same time. So we're talking about current I. O. When we talk about I. O. usually it's about waiting. So here we can wait on multiple things at the same time. time. So things that take a long time don't actually um cause us problems. No, for the case of Django. A big source of I. O. of course, is talking to the database. A huge reason people like using Django is because of the ORM, the object relational model.
Speaker 3: And that object relational model can be thought of as about two components built on top of each other. One is the model API itself. So when you think about, for example, doing uh you know uh model. save Well, that's the model API, right? But that model API relies on something deeper, relies on a connection API. The connection API is what manages talking to your databases. So, you know, you might talk to Postgres, you might talk to MySQL. etc. So this connection API Is actually how we end up getting information into the database. And the model API is how we are operating with the model and transforming that data
Speaker 3: that we can send it into here. So these are the two components. that we need to think about when thinking about the RM and an async ORM. The thing with an async model AP though, it's a little tricky because Like I said above, when we call save, you end up reaching for connections. And uh anybody who's kind of poked around in uh Django code or seen some a little bit trickier um extent Django extensions might have seen uh connection or for example connections default. Django by default When you set up a database creates one connection that you just share in a global and that connection can get you cursors
Speaker 3: to talk to the database. So you have a global connection object, you give it some SQL, and then afterwards you you you need to do things like um like fetch one. to actually get the result. And then you take that result and then you kind of like pipe it all the way back to your instance, you know I mean there's there's obviously many, many layers between this result getting back into the model API, but the core point here is that your model API is going deep using this global object. and uh doing stateful operations, sending stuff to the database and coming back. And these and it takes multiple steps to do this.
Speaker 3: All right. So we have everybody sharing the same object. And you know, if you s if you think about back maybe in college, you'd learn about concurrency and things like that It should be very scary to you if there's like one object and a lot of people are trying to use it. Now, remember, in the non-async world in Django, we do one request, then the next, then the next. So even if you think about your sharing, in reality you're gonna you're not gonna be able to do these operations in parallel. They're gonna be you're gonna do this. Then you'll do this, then you'll do this, then you'll do this. But what happens if you did this and this at the same time? Well, we haven't been writing Django code with that assumption up until now. So it's a little bit scary, right?
Speaker 3: To put a finer point on it for connection API. A current context connection API is dangerous in async context in general Oh, okay. This should actually say cursor, I think. So imagine connection says cursor. But imagine you execute some some some SQL. Then you call a wait. You're gonna await some operation. And maybe you wait and then some other request with the same connection object, maybe it's a different cursor, but the same connection object decides to start executing some more SQL. And it also calls up, for example, you know, it starts fetching. Because you're sharing the connection, especially if you think about things like transactions
Speaker 3: You can easily imagine just a bit of a nightmare where it's not clear whether you're operating in the context that you think you are. You could you can totally get in a big mess because you thought you're not in a transaction, but you are, or you do things, assuming you've committed them back. But actually they get rolled back from another request. So for now in Django , there's this decorator called async unsafe. And a lot of uh connections, uh connection API stuff is labeled with this. It's saying if you're in an async context, if you're trying to write asynchronous code, you cannot use this object. It's too it's too dangerous. We don't know how to handle it well yet. And a lot of code is written without that understanding.
Speaker 3: So there's no async connection with the eye. Yet this is the kind of the interesting part of all this. We have an async API for model. Kind of weird, right? I've been saying, well, you know, we don't have an async connection API. Yeah, we have a mod we have an async model API. What's going on there? Firstly, just to introduce it. Django 's general pattern for asynchronous APIs. is to add an A to it. So you instead of doing instance dot or um query set. get We're going to do query set. aget, save, asave, update, a update. And of course, we're talking about an asynchronous API.
Speaker 3: So for example, if I call asave, I'm going to call await. So we have this API. Right? So it's great. You think, okay, well, when I'm saving, maybe it takes a while. Or even getting, maybe it takes a while for the database to come back to me because maybe I have a very complex filter or something like that or big data I'm sending in. So great, I can wait on the I. O. But the reality is a bit a bit more unfortunate. If anybody has ever tried to use this to solve performance issues, quickly will realize that it doesn't actually help. So here's a fairly simple example. You have a first request that comes in. That request tries to call a safe. We do a wait. Just like with
Speaker 3: the async views we saw before, awaiting will say, okay, well, let's try to find another request or some other work to do while this operation happens. But for a lot in a lot of situations, if you're if you're in a live system with things going on, what you're going to find is that even though you called a wait here, if you look at your database logs, you're going to notice that like Your database request doesn't actually go out for a while. There's gonna be a little bit of a weird waiting period. Um Between when you called a wave and when you thought you started the operation when it actually happens. And meanwhile, you know, in the second request, we try to move forward a little bit. And when we call a wait again, we're going to see this sort of waiting.
Speaker 3: And it might actually be much worse in this situation. And what's actually happening is that these model operations are all serialized. In the async model API, if you're using it, you're only allowed to have one model API operation happening at the same time. And it's happening over in this thing that we call that I'm calling the main thread. There's a lot of details about what what's actually going on here, and I don't really know if there's a specific term that we're that we've landed on, but basically things like a safe all this async model API it's gonna happen one after the other now if you're sharing the connection that makes sense We can't if we s if we want to share the connection, well yeah, maybe one person does something, then another person does something
Speaker 3: But even if you had multiple connections, maybe you had um maybe you have connections to multiple databases, something where Django has a lot of great support. Right? Maybe you have two connections to your database. And yet still, if you call ASave on one object for one database, ASVE on one object for the other one, even though theoretically they're not even sharing connection objects. Looks like they're completely separate from that perspective. They're still going to be serialized like this. So we're only going to do one I. O. at a time. We're only going to do one thing at a time. So what's actually going on here? So here's actually a little snippet from uh uh current Django from uh uh
Speaker 3: Django right now. This is the A the refresh from DB method. So as I said before, we add an A. So we've added an A. It's async. So we're like, oh async But what it actually ends up doing is it actually ends up calling self-refreshment db through this helper called sync to async. Sync to async is a is a method in its a library called asgiref. And what sync to async does is basically this component of the main thread. It says, okay, call this function. off in a side thread and um in the default met uh function in the default part of
Speaker 3: the default uh way that sync async works We say it's thread sensitive. So we say that all of our sync to async operations have to happen one after the other because, for example, they might be sharing connection objects. because they um they might be sharing other like globals that uh Python that Django has sprinkled all over itself. One good example that I'm sure some people have experienced is translation contexts Uh if you have a huge test suite and you have one part that's changing the tran the uh the language. You might accidentally see wakiness in tests because like for some reason your test your your text is in Japanese and now your text is in English. I think for translations that's a bit more fixed now, but uh yeah. There's a lot of parts of Django that still are written under the assumption that it's
Speaker 3: uh not doing things at the same time as somebody else. So yeah. So our current uh Django model API, async model API, is just a wrapper around the sync one. Everything's gonna happen one at a time. You can't do things while waiting. And um Yeah, you're not going to really necessarily see any performance gains, though it might still be helpful if you do have an async function and you need to call something and you're okay with the performance malady but you do need you do you do just want to be in that context. And right, you know there's no async connection API. So we don't we don't have a way of implementing an async model API. Or we do, but it's not a real one.
Speaker 3: They'll put a finer point on this Uh if you think about the call stack, you think in your view you you have a view and inside that view you call um Something like asave. Now up until here, you know, you have your async method, you have your async method. And then if you have this sync to async, that's calling a synchronous method. Um you won't be able to await. Like you can't put await anywhere here. Now of course you can't put it in save, but even if you're deeper in the stack, like no matter how many functions you put in here, there's no real way to put in a weight that will like get you all the way back up here. Because this sync to async or rather the save blocks it in a sense.
Speaker 3: You've kind of you need a chain. You basically need to have this chain. from top to bottom for a weight to go all the way back to the top of the view. And you need to go to the top of the view because You want to be able to work on a different request, right? You know, if you have your request one and then your request two, if you want to await and like go over here, You need the await to go to the top of your stack, so to speak. And if you don't do that, if you can't do that Well then you can't do this either, right? And so it means that we're back to square one. A Django web worker can only do one thing at a time. Um the
Speaker 3: uh some more reading about this, if you search for the color problem, Sbob Nystrom has an article about this. Some people have critiques about this, but it's a relatively good primer on this specific problem, this problem of having this call stack where you have async and sync mixed together and you just kind and you can't really gives uh all the advantages that you think it's supposed to give you. So we want a native async API. Now Django has committed to maintaining its sync API. This is great. Obviously we have loads of sync API synchronous code already. Loads of it. Um we want to maintain it. And on top of that,
Speaker 3: you know, if you're, for example, in a uh working in a in a Jupyter notebook, or you're working uh in a uh debug, like in a PDB debug shell, or You know, working in a lot of different contexts, a sync API is useful, it's helpful. Like you don't want to spin up an async event loop just for this. So we want a sync API. We want to keep it and we want to keep it performant as well. So we don't want to pay huge, we don't want to have people pay a bunch of performance costs for sticking to the sync API, at least in the midterm, because we still don't have a native async API. To have proper async, we need async from top to bottom. We can't rely on the
Speaker 3: sync API for the async ones. And the reason for that is because it's stacked on top of each other. If you call into, if you think about, for example, async view API, you call into your model. And if your model calls into the sync model API, you end up in your sync connection API. So you're going to use a sync connection. So for async Django to exist, we kind of need, we need the server interface, we need the view interface, we need the model interface, and we need the connection interface. We have to kind of solve all of it to get from top to bottom. The good news, of course, is that these two problems are basically solved. So if you're not using the model API, if you're doing things with requests directly, you already have something. But of course the model API relies on the connection API. So without one of this, we don't have the other.
Speaker 3: So yeah. So where we're at now, why we don't have it. Or where we're at now, we're the sort of async JGO for an ORM that does what we want it to do, we need an async, we need a native async model API. We also need a native async connection API. And we also need to maintain existing sync APIs. We need existing code to work. This is trickier than it can uh then might seem not only because you have to maintain all this code but for example right now asave calls save Right? If you override save, then you have a new save, right?
Speaker 3: Give a new save. um then you're gonna call into that. If we change the definition of ASAP to no longer call save If we say, okay, we have a new version of ASave that doesn't call into this, then we won't call your overridden function. So maintaining the sync APIs is not just about keeping the code there, but it's also about thinking what happens if we change ASAV? What happens if we change these methods to no longer call their sync methods? because there's a lot of there are a lot of plugins, a lot of Django extensions that will break if you just decide to change things up. So good news first. For Async Connection API, we're
Speaker 3: we have a way forward that's very straightforward, it's fairly comfortable. Cycle PG, which is the library that does Postgres. So this is for the Postgres database. um has async connection objects. Not to get too much into the details, but For a lot of database drivers, they're not thread safe. They really want you to be using your objects on the same thread all the time, so you can't really pass them around. But drivers are introducing the ability to not have this constraint anymore. And it's kind of required for a lot of work in the internals for how you deal with async methodology. So
Speaker 3: We have the database driver support, so we can jump into the async connection API. The current state of this one is looking pretty good. We have a PR, this is PR of 18408. You can find it either by looking at this number, if you go into the Django forums and async, people are talking about this, by Flavio Corella. And this async connection PR sidesteps the problem of the connection global by saying if you want to use an async connection, you have to explicitly open it yourself. You have to say, give me a new connection. Because remember, up until now, Django holds on to your connection and shares it to everybody. Shares it with everybody. But in here, we're saying you need to open new ones. It's actually
Speaker 3: quite of a different sort of operational model where instead of only having one connection to your database, you might have 10, you might have 20. So you have to be a little bit careful about what you do with this, but Yeah, you can open a connection, open a cursor, and here, for example, you um you you can have a cursor execute. We have followed in this model there was followed the uh idea of putting an A in front of these methods. This is something that wasn't true of the database drivers. That's something that we're doing here And uh here if you do the await, this is gonna be like uh this is like a real await. This is like real. So if you do this, then uh uh another if you do this inside of your view code then another request can be process. So it adds up A
Speaker 3: to a bunch of methods. It doesn't touch the model IP at all. I think this PR is going to get merged in some form. Personal opinion, but I think it is. There's a good consensus on the Django forums where a lot of discussion about this is happening and people are like, this feels good. It doesn't touch existing stuff. It's not going to break anything. The biggest challenge is that it's a new API. So we need to be careful when rolling this out. If people start using it, we need to maintain that API. So we really want to get that ready. We want to really decide like, okay, what How should this look? Is this right? Does this look right? Does this look usable? That's a bit tricky. It's a bit tricky to figure out if the connection API makes sense, especially without the model API to go along with it.
Speaker 3: All API is more difficult, way more difficult. It has many layers. If you call something like a save and you look at the stack, you call something like uh go save, um, then you you you you call into a one function, you call in the function, you have like do table updates. You have All of these little methods that are getting called. So it's mini layers, it's very deep. Django does have support for native sync and sync APIs already though. And the way we do it, it's very straightforward, and it's unfortunate that it's like this, but it's just it's write the same implementation twice. So for example, we have the session backend API. This is the database backend API. There's a function, there's a method called create model instance. You get a session key. So you know you have your session key.
Speaker 3: You encode some data. You have an expiry key, right? This is in the sync world. It's like, okay, so we have these methods on this class and we call them. And in Django, it's very easy to have these sort of pluggable backends. to change how things work. So for your session, if you want your sessions to be stored in the database, you can you can use this. And we have the async version of this. So what is the async version? We have an A. Instead of git expiry date, we have a git expiry date. Instead of git or create session key, we have a git or create session key. And of course, await, await. Async. So if you look at this, you know, we have this code and we have this code.
Speaker 3: Kind of the same thing. Kind of the same thing. But we have A's and we have voys. Now the good thing with this is that we have two native sync and async APIs. In this case, of course, we're calling into the async model API, so it's not truly async, but But we're maintaining two implementations, right? We have two things of the vaccine code. And here, this is one statement. But if you have more than one statement, if you have 10 statements, you have 50 statements. And if you look in the if you look in the model code, there's a lot of functions that are quite long. You could be easily looking at Drist. And yeah, uh model API has a bunch of helper methods like do insert, saves table, save
Speaker 3: parents, all of these methods. And if we want to have two implementations of these We'd have to be very careful to not change one and not change the other. But really , if you think about what is the difference between these two, well, okay, give your weight. You have A , await, A. Now, if you have a sync API, it's hard to put these in. You need to know what methods would require awaiting. But if you had it the other way around, let's say you had an async API, well I can go from here to here, you know. It's a mechanical almost. Like you look at it, you say, okay, remove the A, remove the await.
Speaker 3: So this is the idea, right? Can we have sync APIs of course, but if we had an async API, if we had an async API already, could we go from the async API to the sync one? Can we do this automatically? So here is my proposal. My proposal is that we write an async API. So we write this first. And we add a decorator here, generate on asynced. And after a transformation process, this will give us this. And here it's we're saying we're moving the weights and we're changing method names that are called. Now the method names here It's a little bit interesting, but here we say we remove this one
Speaker 3: to remove this because it's in an await statement. But the idea is to mechanically transform this code because it we wanted to do the same thing. But we need to uh for the async API, we do need to label where we want to um await. So yeah. So I've published this library called Django on Asyncify. It's available on PyPy now. And This is a separate library, not part of Django proper, but it's a library that will scan your code base looking for this decorator. It transforms the code by erasing your weight, removing the A following Jane naming pattern. So A get turns to get. A save gets to save. And because it's mechanical like this, if you have any method, you can just make a version of the method with an A in front of it.
Speaker 3: And this transformation will be able to happen syntactically. It doesn't need to know about your library. It's just changing the name. So what you do is you can write an async implementation. You can write your async API, and then you run the code and you get the sync implementation for free. So no runtime costs. For the user of the library, they just see two independent implementations. For the maintainer , you maintain one and you generate the other. So for example, if you were to write something like this, you would actually only write this one here. You write this method. And then you'd run your you'd run the the command in Django on asyncify to and it would actually insert this directly into the code. It inserts it above.
Speaker 3: And the reason for this is that currently in the Django source, usually the sync API is first. So when I'm doing this, I'm able to write the async version, generate, and then the diff, if you look at the difference in Git. You can see, oh, the sync API hasn't changed actually. Because in in this model committing the uh generated version. Now, personally, I would love to be able to use Django asyncify on async to add native async model API support. I would like, I think that code transformation here would mean that we could um have uh async uh like native async native sync apis
Speaker 3: no performance loss um backwards compatibility for everybody using synchronous apis And by doing the code generation, we're able to see what's exactly what's happening. Whereas if we try to write something that happens at runtime, we have to figure out if runtime code is doing what we think it is. Even with sync to async, there are very subtle and complicated bugs around uh concurrency issues. So This project right now is on PyPy. I have a branch where I have successfully used the model API to save two things at the same time. There's a lot of issues with that branch, of course. And I have a DEP, so it's a Django enhancement proposal, similar to a PET
Speaker 3: in Python, describing this. It's called unasync code gen. There's it's the PR for it. This is still in progress. We're still talking a little bit about what actually makes sense. And in particular, what I would like to know about is if anybody is using any third-party libraries that have sync and async APIs. that are basically maintaining two implementations. I would like to know about these because I would like to introduce Django and Asyncopy in order to capture that. And just uh a last little point about this. Using something like this code generation would mean we are in um Good company. Psycho PG itself is using this. There are a couple other library that reached out and said that we they also have a code generation that they use themselves to maintain two
Speaker 3: variants. Django ISyncy has instead of generating two file like separate files from one , it generates, it modifies your code in place. Because my ideal is that or the model API transition in particular, if we could generate uh diffs, if our PR diff can show that the sync API has not changed at all in this process, then that would be excellent. So yeah. Quick conclusions. Still very far away from an async model API. There's still a lot of work to be done. There are a lot of problems that I haven't mentioned here, just about how the semantics of when you're using an async one should work. The async connection API moving along quite well. It'll
Speaker 3: unlock abilities for us to explore or have a third-party libraries maybe do some monkey patching or something to kind of test things out and figure things out. Because ultimately, while it's quite hard to merge something into Django experimentally , If we can have third-party packages that let other people experiment on their projects or run things in a non-production environment, then we can need a lot more feedback about whether or not this makes sense. But there are many, many, many smaller issues that are still yet to be resolved and kind of unable to resolve because we just can't get the basic functionality to work just yet. But hopefully. I'm hopeful that with some of these ideas here, we'll be able to move forward. For people who care about this
Speaker 3: too, how can you help? So the Django forums are a great place where people are talking about ideas. The internal async category is where people are talking about async stuff. There's a lot of stuff in there to read that you can read as well, a lot of back and forth. So it can be a bit daunting, but even if you have an idea if you have an idea and you're worried about it, not Not being super well thought out, it's still worth bringing up. There's not that much traffic in there, so people will, I think, react to it. DEP009 is this is async Django as a whole So this was written about uh five years ago, which kind of gives the original, it gives a bit of an overview as well about problems with async. Basic connection API PR, like look at it, see if you have if you notice any problems, review.
Speaker 3: I mean it had a lot of eyes and it's getting quite good, but More eyes the better. The only sync code kit gen DP that I've written, if if people can look over it and put some comments, if something is complicated, uh or some is there's something you don't understand. Yeah And maybe benchmarks. If people have any sort of internal benchmarks for Django, this would maybe be quite helpful, not only for this project, but for others. Several people uh several Django uh contributors have expressed interest in uh having benchmarks so that we can test some of these changes and see if they actually affect people or not. Uh but yeah. Uh that's it for me.
Speaker 1: Thank you for your talk. Thank you Thank you so much. It was so interesting. Um I thought I thought there is uh a thing API on Django models, but uh inside there isn't. Uh yeah, yeah, exactly. It was so interesting point for me. So uh The talk is until the twelve o'clock so that we have a little bit of time. So uh most if you have some question or like a feedback, please comment on the YouTube live comment. Uh the first uh from me um uh for me it was so interesting the uh on async file. It's so interesting.
Speaker 1: for me. My question is so the implementation of that library that uh when when you when we write the decorator uh on a sync decorator I is this is just uh tagging or tagging for uh yeah and uh some command will recognize that generator uninsect. And also the form called gen is just a tag for that uh the decorator is just as a tag, is it correct?
Speaker 3: Yes, so um I'm using this library called libcst um to do the transformation. So compared to doing a transformation with a library like AST, it keeps, for example, formatting and comments. Yeah. And what happens, right, is when I run libisc, the first thing it does, if it sees from code gen
Speaker 1: ,
Speaker 3: deletes it.
Speaker 1: Ah yeah, yeah, yeah.
Speaker 3: And why it deletes it is because here we're gonna create it again
Speaker 1: Yeah, yeah, yeah.
Speaker 3: So so um the right these decorators don't actually change the functionality, but they allow this library the library to know, for example, that because um we that this one is should be managed by the code gen by by code gen and it makes it itempotent so you can run the command as much as you want and in theory if you haven't made any changes no code changes I think there might be a little bit, while these will still be tags, I think that we'll end up doing something where we'll need to be able to pass in some arguments here. But uh for now, yeah, this is purely these decorators um
Speaker 3: just don't do anything. They're purely tags. Yeah.
Speaker 1: I see. Thank you so much.
Speaker 3: Hm. Yeah. I guess uh let's see if any if nobody has any questions there is one thing I will mention.
Speaker 1: Yeah
Speaker 3: um So this is, I said that, for example, you know, if you have an async API, you can't call into a sync API. Um now the opposite is not necessarily true. It could be possible to call an async API
Speaker 1: Uh you mean you can't we can just we can't await, you mean
Speaker 3: right, right. Or uh what you would do is you s you create a little event loop. You just create an event and you just like this. So you can do this. Now the problem in current Django is that because our connection API is sync, what we'd have to do is we'd actually have to go back into sync world. And um this is cheap. This is cheap. But this is expensive. This is really expensive. Because we have to like basically wait around. So my I'm proposing code gen as one way of resolving the issue of two implementation. But um if We didn't have any synchrono like if we only had an asynchronous connection API.
Speaker 3: Like this cost goes away. This exists because we still have synchronous code. But if a sync API calls into something that's async and it's only async, it's actually relatively cheap. So one of the alternatives that might happen instead of code gen is that uh we actually might figure out just to Like have all the code be natively async. And the sync to async cost is only paid once. Async to sync is expensive. We have to wait. We have to synchronize. But if uh we're async native everywhere, we don't do this. I'm mentioning this as a possible alternative to the code gen, but uh we'll see. It depends on what we can get to work.
Speaker 1: Thank you.
Speaker 3: Thank you. I have an iPad. So the iPad I is and there's an app to like screen share onto a part of my monitor and then I am uh Using that. But yeah. uh i if you have good handwriting. No it's but it's I found it quite useful. I've used it uh for a lot of presentations like this
Speaker 1: Thank you. So uh there's two minutes so that uh I want uh uh I want to share that uh we We the the Django community in Japan can also uh we we want to contribute to the Django Quo stuff. So Uh so you you mentioned that uh you uh we need to uh some uh leave a comment or something so that yeah we want to do that. Uh also uh I I want to use this Django on Async fly tr try to use our project and to send a feedback.
Speaker 3: Yeah. Um right. Oh yeah, please. Uh um like And of course, I think um this is also I think for some people, I know like it can be pretty tough to write things in a in their non-native languages but I think if you are comf if you should you can be comfortable like posting even in directly in Japanese or something or
Speaker 1: pretty
Speaker 3: uh I know some people well I know some people they will say oh they will machine translate their things and then post it. Uh it depends on the vibe of a conversation but I think like I've heard many people from I've heard several people from the Django Software Foundation mention that they want more international participation in the conversations. I think that could happen maybe even in an imperfect in an imperfect way. I don't know what that looks like, but I think it would be very interesting if people from the Japan community um were were present in, for example, the Django forums. And I don't know if that looks like maybe like a Japan sub
Speaker 3: for like a Japan a Japanese language subform or something. But yeah, yeah. Um Of course, uh yeah. So uh yeah, I've I'm saying please participate. It's it and uh if people have issues is like people are a bit uncertain about their thing too, also just posting um sending to to certain members of the community about this or even even machine translating them your message or something and posting you know both versions of it I think is something that a lot of people will be very comfortable with in the community because they understand that it's tough, especially in longer conversations. So yeah. Um I
Speaker 1: Thank you, thank you so much. Thank you for your presentation, Rafael. It was so interesting.
Speaker 3: Looking forward to the other.
Speaker 1: Hi , dance time we need.
Speaker 1: Uh , uh
Speaker 4: Eroshkonto Watashino. Nekikayaksu
Speaker 4: gotemonde ward and this given more, so no kikaiaksu dekta, kikaiaksu moder to kawa, product waste, katsu to look at the kami. So kude, fast , wo, kun kainu, e confidence, kyudikta danato mutte, andokaiwitakimasta, ale to zajamas. Shtata di Toka, Atwa e Gitohabuano, Ft next to Riddin and Diskado, Konos Ridwano Shin Ks de E to Atodake Sangatskut, Sukhinks the Birges, Yatsutka State Light and Diskado , Masokouni Chotoko
Speaker 4: Kakchot, Linkat. Eh , so you can not have not seen always good , I shouldn't be an ingredient. Jenka I know, Nisan just and not Django congruence the waiting about ill come on, and the Django printing is near, couldoscript in the kill the jacks, madame, smash up. Ki ta putu katoto kawa. Namao ki tapotuwa, yasun is you want it. Manahuki Takotovan Jekato
Speaker 4: Motte. Sheky Sona noa na kakonotok to moi punkrai kamita you watchinate was entangly no cat in a tis ago you can give us a The equity , which is a little bit of a dee to motoni, stay at the motif decent, the bit of the saber , the same thing. Korea, today that we can describe, Niseni Juyeneva Shiruke, Judonishina, Koreo Miti Masaga. Kurano, web cusuno , cono cocoe, bequet stokact, and a cryantuken rival height in the tansorch to Atashinano
Speaker 4: The moiko, betsino, a to data science to mitena. So let's into shimit and a toke moreimashite, ujiwa, data science that too, who has idea. Hunt Michel, Django, Firascutade, has ticked a detect the No Kangai to Kanaliku, Sinto Sikhta, Sun Zayano Kanato, Motorimas
Speaker 4: Et oh shape de ma Django de to and you are de building no cancer to yell in the past. Srash to Pasani get to the operation aktu. The Kayaksu no moderable sabes yoto motara match to ninja ma oito
Speaker 4: oito. They are the site of Juju Not anymore. But they include it.
Speaker 4: The psyching is a youngda, you would say that was a good idea. A jangua battery in good. Then she doesn't con this unit. Atto Chigaito Stewah Hidokitayu no do Ide, ma Jangoano etto Bubuntekina, modon chitomada to marato kanate, soy n soyazado ina canata , i pofastepeiwa, jibunny, hidokitayoshemasto. The ma don't chicako, what's an i tomotic, so is it to kill to monde, ma sono tokuyo hidaska, skyba?
Speaker 4: Ayy, the game backalati would be game bano joke on it, staito he must stop. The Dadika, Michael Kwasic to Rita to you back at the monaco, has to be no matter what yatta uraino. They watashiwano go to conference , talk to come. But pay contour and talkina
Speaker 4: itemasto. The son of a data channel. Sabungar no de soono sabun toko outside masga, eight ten chui topia ni jikutishina in hot, nanto yukano. Jitiza mottokuetio metaina, so you coment about the same thing. The konata inokijba and a kokonito yagetik ne mightanko nosra. Kiomerba mediata sai. The sour to my example mustai, no, kevai sandwich, and the other, and the body made all the Django democracy, the kimasionato
Speaker 4: , a sink. I should maticulate. Ah, so I know what I see how much. De ma Django to send back shimat and this kiddo, miniature to faster PID. So she didn't know how you have to do it. So, we have to do this. Kino
Speaker 4: some to go, sketasomita can day, uh, Matani, Tsketa, Seka Nankao, Ibitsu inacho to Radno de Makisono Seko, Mas not , go minaoste, Yoli, kaku siask na beonicumitena. Kuruna Hanashi will touch the Honda has ready to get no external programming. The car has not more. De usa storiga, dikte kurika , soriga, doyatara, war no capinosh mys
Speaker 4: to kimas. Kono ukari test to gatara can yo sue. Kison J Sovo kakuchos se keu, kangaete, te testokudu, kaihat, de so the committee. Crash Silicata no Dorian Kotara, Yoi, Sido waged it on a day. I'm not counting bigger this chancellor, Yo. My okay , Katayottehunikanstara Muishkinow the deploy now. Biasika high chapter showymust conkap container iste de e to G. Microsovic na API
Speaker 4: no shot of ste must. A sample application.
Speaker 4: What has it done? Start it to Monoto Paiamtikolo. And the start to an diskado , you must get the oysters, and then we can see that the same thing is that we have to do this. So encoder
Speaker 4: , it's a very important thing to do. The microphyth disney.
Speaker 4: So there it's not pass new te make katekini, jikojni validation kakata litoka, mato, kataka kate lucara, edita day who can step kakerio mi teda. So you are no kaihat , Aye, eh, snee down. Don't
Speaker 4: give you a shin could definitely send the showkatitous ne? That's not a piano , which the question is kiddo. I you about the Tinoir Ma guy with the Mozart 5 million matchy on the joke , eh? The Hidoki Ayotemon, you could not show in Tai, Shipyu bound, niwa, you call the night.
Speaker 4: CPU coins cuto. The kite take that. The Korea Ma, it tay not to Gadinica to Yuk, Python of Importoshemol, I wait to Kiwato, Skyta, Aishing Difference. Skywalk. Now they Kono Kura it to open or I know Hidoki did. Now it's inconnaid. So the old skat tatokini, so no hidoki. It must be the Shiva away to Tska N de Ma no pass operation consul to Shemo ishin could define animas unit.
Speaker 4: And she be bonded a car, they kite who I don't document this. A brooking I also record scana in that. To your kidokayo matomerito, a sakina Zatsuni, Tautoma, no, Ranya Kuna Skido, Hidokayo, supporters that I 'd sky on iste de Faste Pedirano, Aishinkotiho, Kiti, Kimashoto , she wants to more chimas.
Speaker 4: They ma paidantic kupodemoti mastep. The moiko, escher kimi, deskeredomo, kurama, kanali, leximali massi, dai shotkina, u arm kanat, umot maste, de kono kuma sker kimiga, de vin hidoke o sapotosirutinoga, hijo kiko do kanato oimas.
Speaker 4: Yeah, is here the model session take your silence schedule. My skid modernae, session, ishing session modern disgust, Kotila, Kodida was a skidding, session ishing session woo, casual stamunatimas.
Speaker 4: They conoschion it's day executes, and we're going to be able to do that. So they were no exact one, never the article must be so. Now they 're must you have to session make a sky time to go. So it's
Speaker 4: kind of document to the other schedule. They watashiwa code chop though. So can I say you'll make out scout kodeshirutino animals? Look at this name. The gono ka is the key, it's your mask. Exactly, katakata, yet tanatic , eh?
Speaker 4: Es que no shocan disga.
Speaker 4: A robot she martins up, uh I show an obsang. The Korean architecture is a little sailing to the same.
Speaker 4: So you hanashio state you must be able to do that. There, uh , Kozira Diotiponi Kaita, Adimasto. The Konozuaj Konozu dakestoria because the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that
Speaker 4: They sort of so no cantan sato , so could I say to come? Application of the framework. So no, Django stout , API with Sautaka, so if you remark no sense to car, guttaino devi mitskauka, mitainoga application choosing there, attached to yoin baroka, mitain, take it up, or stillund that you guys. It application of choosing the business. De e to choose in your business.
Speaker 4: But framework was a shake anonymous. You go to kayakanato, Moshinanka, Khodekyomi Mutte, Motu Siditainata Muta Kataniwa Knutati, Watashiwa Kunata yemana y mustat you sanguzu hudis.
Speaker 4: Nunka, you skips the water to cara. Mazza. Computer
Speaker 4: system. Thank you. So you know , you can see that you can see that you can see the company. This odema domain modeling umigana what I want to machine, Konoma Kekko domain, Jikamo Skat theater named a kankaka shake, A domain modeling. Computer number secai was zero cai
Speaker 4: connect the skill side. So no, Kaihat. Then you see this on me now. They're frozen to root in the world.
Speaker 4: Madame Mada, I must get all so no. Atomat toximethika, four the choceth mastery on the four four book in books , but I see Tanoshina. It's the use case. Domain of the skill no domain. System there, Gory, you can kadayo kaikit logic, domain to pro up, the system
Speaker 4: , etihanasi. What I should know they have. Domain to use the application of the catch up in this kiddo. So let the memory accompanying coach in this kid off. I would like to use our sky night. The poll to announce committee.
Speaker 4: Interfaces. The use case was not segado. Use case of small portal.
Speaker 4: A database could database, next.
Speaker 4: They don't want to put a mother at the gateway and a good time to gateway in his own chapter and see you. Skyday to this.
Speaker 4: The my gaikai karata ma only dayby cut the skill module. Request so couldn't be digital digital, but digital no key to cover the problem. Moziret stuka, in toka, so you programme yango putty video, ataga kukar, so we will domain tage. The eto gateway the more interface of the Kurano Doraybait. And they are not gateway more. So it was to go to Hanacharat in a Sakin Hana.
Speaker 4: So domain no katawa sent you to this. Hi , gateway and interface of this society , postogres you know , database to IBA. The moiko you don't sked, machonosito web. So could they know for the market?
Speaker 4: Atto, it 's API no response no catavore. Domain no katavox has a new API, me cell. So no feared of te ma domain to tamatamai chicot command. The portal interface this day, use case what interface or
Speaker 4: gateway, the chat shows. The day yani chisko tatsu dak, hanashima stop, ikwa sakino depends de eto naka depends, kukunyate, kure nani yatendamita, hanashina diskido. Kisu the Nashidio Baritadoki, no, Kayedichi could mittain na kinopisne. Hyogen library typing no katahinto de kakerio in aptranskido, kolek katan tas
Speaker 4: the metadata of yo stereo depends the metadata do stewata sterun Depends the te. Now skeddo, nunka. If you have a lot of things that we have to do, you can use the same thing. There, depends in the card because it depends. Read the query straightems, a yobare. Depends your baremas. Depends your baremas.
Speaker 4: The coronal lens would scale a deb session. The Korea anno watashika umiashtaba kita s nean Homorosan no e to Sbarashi depository o scodori andarko kwetera de kill in up to skande yarn to you canash the Kyomikadala, kot chyba mikita nuga, butasikanato my mass, Iano. But I should know repository. Question about the other mat and this kid. Depends that this is a use case no katakinto.
Speaker 4: The kotolin no some mutabilist, mutabilist, integrated scope of the came to the kinosome. Koreika yay, yeah it 's a hot idea, not the domain. To Gaika in Katao Henka Maggaika in Kata domain Henkanstein skill. Domain te debi no de godonsono escarmode.
Speaker 4: Wakakho can't the Yarita Kotovo Yatimita Kuruk and was the Mr. It 's Kurushima Yatimitao. They have chiski or they come to Kotova Dicta. Yeah, say about what are they see? So you go, I know, Temizikani, two fact up to the first time.
Speaker 4: Touchdown. They set the concue on the database setzukawa concu hensika watchimashoto. A concuhenson attayu kairi dakede, codwa kainak to mo nakakuo Mukisaki akarmitina Munoga Mozumashito, Saratimas. The images , you can use the same thing. No, you are not going to be able to do it.
Speaker 4: Notakono. It's a base setting of cash or shakuras no feed up te cankyo hence zemb or mozzi nisha kankyo hence the set. The microscope application started to concuence. Debbie Noshano P G D S and Debbie ansko P G ansko the send this co tatuaristic. Hi , Skaltukiba no sakino, ikumaino, konfigur, yomikon dikite. Hi, what does that?
Speaker 4: Ehk on creat, sorry manish machot in a fuck up in Kite Matashkanyano, it's not covetes can. The road to handle the format. You to de mafta, so it's only handsite, propagate up to you,
Speaker 4: then pass the screen of teacher, just so that 's the problem. Hi, Ulega, eh. Echo to the horse to echo cancer on skedophobic. Yamuru Fire Day, Tegiste, you be konkomando fakto kinni, logukiseni, batashtag, eskerki no, eskernukamo, but Irootskide, ichiroski de masto.
Speaker 4: Ay , payantic settings. And atomemas , sentence , could be the application , right? Then you come back mainly should take that noa may read also there. Business logic to make a deviation, Kiana stats, no can see a bundle start, the kimasio dehanshi. Tada Kurewa, ma 'am. E could not take your easy initiative, sky cater to the musical day, but not to come. Hi.
Speaker 1: Hi, Ariato Daimashta. Chodo Yonju Natash Maimasan Tokawa Naside et O Zehi Ehki Sanno Zita got no FT Nekosto Sunday atari eh discord no hold it was moita umas arigatoimasta
Speaker 1: Switch. Hi Omata, since the next talk is speed at scale for Django wave applications from Chris. So uh please make presentation. Thank you. Uh let's get started.
Speaker 5: Okay, awesome. Uh hello everyone. Uh thank you so much for uh for your time and and the opportunity to speak at uh Django con this japan. So um just this a little thing uh just uh some some little points about me. Uh I'm I'm Chris Achinga, but I I always go by the initial C A on on the socials that is on X mostly. And uh a few things about me is uh I'm an individual Django Software Foundation member as of 2025. That is uh January this year, I think. And I'm also uh been a software engineering lead for four years at an NGO in Kenya Where we primarily use Python and JavaScript.
Speaker 5: And um I also do write technical articles uh mainly on Django and React and also building progressive web applications. So I I do love the web. And I do talk about the website, the web technologies a lot, especially the progressive web apps, Project Fugu and whatnot. Um one thing about me is I love tech communities and more specifically I love uh content-first tech communities. So these are basically communities that are prioritized sharing technical content to their community members and uh before anything. And I've been using Django for the past four years. The first time I use Django is for um university project where
Speaker 5: I that's one my interests interest group so uh very quickly uh I'll just dive into into this talk So this is not the first time um I'm talking about, you know, uh building websites that uh uh I know uh speed at scale. So uh the last time I had this talk was last year during um a conference. uh it's called Angula Kenya. And I I did ask a few questions to to my followers online. And the question simply translates to how do you make your sites load faster and and instantly. So the kind of responses we got uh were pretty interesting. And uh a few people were talking of reducing the number of HTTP requests.
Speaker 5: uh compressing large media files, uh reducing X lengths in code, and loading content from CDNs, uh that is whenever they're needed. Others are saying optimizing images, uh using lazy loading and of course using CDNs, caching your websites. Um I optimi others were saying optimizing images using OP format and of course using lazy loading are still on using CBNs to serve websites from servers that are closer to clients and enabling caching So users don't need to reload everything. And of course, uh reducing site redirects. So this really brings up the question uh what is speed at scale? Because uh everybody, everyone, everyone, everywhere has
Speaker 5: their own definitions of speed uh and also the definitions of of scaling. So in my opinion or based on the experience that I have on the research that I did um Speed at scale it's it's basically uh how effectively or how quickly uh a website can can operate as its usage grows. So that means uh Does the that does the website or does the website uh maintain a higher speed or higher interaction rates uh with an increase in users, uh an increase in traffic, or an increase in legacy uh on in datasets. So this could translate to uh site performance. And of course uh speed at scale could also
Speaker 5: uh Be defined as how quickly a team could deploy updates or how adaptable is the app's architecture to to grow without breaking it, you know, without it going going down. So that again translates to such resilience and agility. But um for this talk uh key focus is going to be on uh site performance, that is performance at core, that is uh speed of course and then performance and growth, that is uh scale So yeah, um why why does does this matter? Why why are you having this talk? So um I have been building a couple of Django applications. Uh Not a couple really, but one very huge data intensive Django application.
Speaker 5: And one thing for sure is speed matters. Uh users have a tendency of getting bored with, you know, when websites are are delayed. And based on statistics, you can say that a second in delay of page page loads reduces conversions by 7%. This means businesses, uh companies are at high risk of losing users or partition clients if their websites or their web apps delay even by just one second. And then 53 % of mobile users of course abandoned pages with more than three seconds of page load time. Most of us, of course, uh get frustrated when you are loading uh websites that take even more than one second, uh let alone three seconds.
Speaker 5: And then there was a research on uh a report by BBC that it lost ten percent of the users for every additional one second a page takes to load. So you can imagine uh the amount of loss, losses uh the company would have occurred. And then uh Vodacon uh did an improvement, uh 31% improvement on their LCB that increased uh you know sales by eight percent Uh by LCP, this is uh largest content full page. This is uh definitely finds us uh how fast or how how long does it take for a website to load uh all the items in the viewport. This could be images. texts, uh videos, any content, uh how fast that is that does a website take to load to load that. So
Speaker 5: performance of course uh equates to retaining retaining users. And by this simple graph from uh from Google, you can you can see that uh For a site that takes 2. 4 seconds has a 1. 9% conversion rate. And of course, you can compare to a site that takes more than 5. 7 seconds to load, has less than 0. 6 % conversion rates. So this clearly shows how uh performance is important to companies or businesses that uh fully rely on uh the the websites to to conduct the activities. So uh those are questions of if instant is better than fast.
Speaker 5: So what was the difference between uh you know instant loading and uh uh fast loading? When you talk of instant loading, this is uh website that is much smoother, uh which is a website that are seamless, uh have a great user experience, and uh when it loads, users don't really have to wait for anything they can just quickly or immediately start interacting with uh page features uh or page activities. So when a page loads instantly it of course has uh it of course leads to a greater significant increase in uh user engagement and certifications A website can be fast, but users will still have to wait for very few seconds, uh one second, uh 1. 9 seconds at most for the page to launch.
Speaker 5: That means of course uh there's that waiting time and of course it can be frustrating. for for some users. So um there's a there's a couple of things of course that needs to be done. This is just a meme that we always share when uh the team says uh the website is done but uh not yet because there's a lot of optimizations that need to be done a lot of measurements to see if uh you know speeds are up to par And and everything makes sense. So that's b that brings us to to to another question. Um what really makes Django slow? Uh of course this again narrows down to how uh an individual or how company architectures
Speaker 5: their their own their own Django platform or how an individual develops their own uh app this narrow again narrows down to um individuals develop up development practices and what not but here just a few things that uh we may we may we may share uh common points with uh almost all developers around and and the first one of course uh talk of database inefficiencies That is you have too many queries on on your views and then you also lack a couple of indexing on the model fields And uh one thing Django is notoriously known as is uh for blocking operations. That means uh heavy I/O or heavy input-output uh tasks. in uh the request re
Speaker 5: uh request response cycles. And then of course uh fewer caching strategies. I personally didn't know uh didn't bother doing caching on on my applications until recently when you hit uh a certain number of um users uh in an at a given time. So not leveraging Django's uh framework, caching frameworks will really make uh your application slow. And then of course an optimized middleware just using uh many lots lots of middlewares uh without uh you know, considering the number of overhead requests overheads per requests, you know, and then uh inefficient uh asset loading. That means uh you may be using very huge and compressed CSS, GSS and you know uh
Speaker 5: media files. We uh we do love good UIs, we do love uh interactive websites, but they do come at a cost. And of course um And upward hosting, that means using insufficient resources for traffic demands. So uh one thing that's uh that that that may may come a lot or especially when when talking of uh performance is uh one thing has to be sacrificed, you know. Uh when you want your website to be fast uh when you want to website to be instant instant that means you have to do maybe you have to do a lot of caching and then but then it means you'll compromise on uh device storage or when you're doing uh high-end uh you know
Speaker 5: server powers that means you're going to compromise on you know server cost But again, um I don't Django uh what makes websites generally slow? Uh let's remove Django in the picture. Now let's just uh have having uh different uh different web frameworks. This could be React, could be Angular, could be Django itself, could be Flask, could be WordPress. factors that will uh will cause uh websites to be slow, including uh those that we share with Django, uh poor caching strategies, large files. uh sometimes the website scripts that you have that means javascripts connectivity issues this again it's on uh the end user side
Speaker 5: bad or very poor hosting, uh server performance, again, uh lots of HTTP requests, heavy traffic uh too many ads, anoptimized code, excessive flash contents, too many plugins. This is mainly for um WordPress size. So uh what what do we do after going through all these uh uh factors that may cause our websites to be slow or our websites to perform perform really low. So before doing anything, of course, uh you really need to to do some measurements. Um So that means uh on the Django side we have tools like Django debug toolbar which helps in monitoring queries.
Speaker 5: cache usage and also execution time. So when you're using Django debug toolbar you'll see how much time does a query take to execute, uh how much resources does it take to do the execution, and uh you know the execution time. uh at all and then there is uh jjango silk which analyzes middle wares and uh the query performance and then you have uh python's uh built-in profiler called c profile which gives deeper insights for uh performances of Python-based applications. And then of course the most commonly used is Lighthouse, which is by Google uh this is this gives you uh tools to measure your perfor your website performance uh of course the front end performance from from your browser so you just
Speaker 5: uh load to to find uh numbers like uh how much does it take to you know to fast content full paint uh LCPs and and whatnot. So After of course measuring uh knowing knowing the numbers on the performance of your websites, uh there's a couple of things that you need to do. So we'll start from the Django side and then now progressively move towards uh the front-end side. So uh these are the most common things that we always talk about, uh, you know, using the right database indexing. Uh Indexing actually speeds up scoring by reducing the scan time. And you can run a few things to check if your models miss you know uh
Speaker 5: indexes by running, of course, uh the inspect db on on the on the man on the Django on the managed spy. And then of course you can do query optimizations that is uh using a few methods or uh like uh select related to you know to reduce joins that means uh you know how Django is uh makes it easy to query things so it's it's it's very s easy to to overlook at the performance and keep doing queries that uh have a lot of um you know uh uh how do I say that long queries I I think so uh and then using prefetch to optimize uh many to many relationships and such like that. And then there is
Speaker 5: uh connection pooling that is you can do this to reduce uh overhead by keeping the database connections alive. That is you can use the ConMax edge settings. And then of course if you're using Postgres, you can use the PG bouncer to manage Postgres SQL connections. So uh one thing I'd love to highlight is some of uh especially when it comes to optimizing queries. When you use uh things like prefetch related, they they do have um they do have some similarities of on how you can also optimize such things on on the on the front end side and I will do share something about it. And then of course um there is there is caching there is caching for speed
Speaker 5: So that means uh per view caching uh that means uh different types of caching in in Django. So Per view caching is definitely it's just uh doing a cache per an entire view. So figure uh a view function, so you just you know cache the whole the whole view function uh depending on uh on the usage or maybe how frequent that or frequent users visit that that page a page that uses a certain view a function that uses a certain view and then of course there is um Template fragment caching, which means you just cache a specific part of the page. And this could be uh maybe it's you're caching the the header part where the header part you're getting, uh maybe you're acquiring
Speaker 5: uh maybe uh the latest number of products, maybe total number of items on a cart and all that. And then of course there is a low-level API caching, which of course is uh storing frequently used data and uh database query caching. But one thing with caching you have to be very careful is uh too much caching will really uh consume a lot of memory on uh either the client side so making again compromising on speed if there's no space left for for your app to run. Of course. And then now on backend caching options options, uh we have options like min cached for large scale uh caching and then your Freddy 's uh which is uh I think the most commonly used uh
Speaker 5: tool for caching. It's it's really good at advanced operations like uh And validations and and and expiry. And then of course there's local remote caching. This is for single server, single server deployments. And then the next thing you can probably look out for is um load balancing and uh horizontal scanning. So load balancing helps uh spread traffic across multiple Django servers. hence ensuring you know high availability and also high tolerance for faultiness or maybe just issues that could have happened here and there. So how to implement load balancing it's uh You can use uh Nginx or HIProxy to distribute requests on on your server.
Speaker 5: And then of course uh for uh you can also deploy using multiple unicorn workers of course and then of course uh running asynchronous javascript using UV icon uh for you know for asynchronous processing as you know the theme of this Django Congress is. And then of course you can use a distributed cache that is a good example is Redis cluster. And then of course a database replication that is s things like uh primary replica replica architecture for for the Postgres. Okay, um we are we are almost done so don't get bored please And then uh the other thing is uh optimizing your middleware and and your requests.
Speaker 5: So uh We should we should we should really work on reducing uh middleware overhead. That is uh please remove those unnecessary middlewares uh that your apps don't use. I know when developing when doing some tests you do find some awesome or quote unquote cool middle layers that sometimes make uh the development experience really you know, really smooth and easy. But uh if if they're not gonna be used on on deployment, you can just you know remove them. And then of course using white noise for static files uh to avoid uh Nginx serving Some in the static files. And then of course um compressing your your responses using uh GZ
Speaker 5: middleware for text-based content and uh you can use broadly compressions for even better compression uh compression responses results. And then of course uh minimizing HTTP HTTP requests. And then of course um uh we have using asynchronous processing for heavy for heavy workloads. Uh traditionally Django uh is is is synchronously is synchronous, sorry, for blocking uh request but as of I think it's Django 3. 1 uh it allowed IA operations without you know bound blocking. So this means now you can have uh You can use uh things like asynchronous views, uh background tasks, uh using Celery or Django Q
Speaker 5: to make sure that uh your app runs, you know, asynchronously. We've had a lot of talks today on uh creating a synchronous application. And then of course you can do streaming uh responses uh to improve you know perceived performances. You can just use uh methods like streaming HTTP response and then of course uh using Web sockets uh these are mainly Django channel for example Django channel channels for for real-time updates or maybe applications that require continuous uh continuous you know interactions to and fro. And then of course on the on the front end side um For my end, this is where I I mostly overlook. I 've done uh potentially I've done all the optimizations, all the good
Speaker 5: uh uh say developer practices on making Django fast from the back end, but on the front end side uh we I I mostly overlook it and there's a couple of things that you can do of course using uh Optimizing static files by using let's say manifest static file storage for cache busting and then of course minimizing uh CSS and JavaScript using Django compressor And then there is using uh content delivery networks, uh serving files of course, uh Cloudinary, um, street buckets, uh and all that, and then leveraging Cloudflare for caching and security. And then of course using lazy loading for images, pre-fetching critical assets. As as I
Speaker 5: mentioned before, on database queries you can use prefetch and also on the front end side you can you can you can prefetch resources. That is you can prefetch uh you can you can prefetch links, you can prefetch media files, you can do a lot of um you know optimizations on the on the front end side that will potentially help your websites you know be faster. So yeah, uh that's that's uh the end of my of my talk. Uh I know I've been pretty fast. So maybe is there any questions?
Speaker 1: Hey, thank you for your talk. Arigato Zaymas. So uh we have a until 40 minutes so that there will be in 23 minutes So we have a little time to talk. So uh first question is uh coming from me is uh you you uh at all other point so uh when you put uh Django uh frame Django Django and then some g unicorn or the uvicon and do you put the engine engine x in front of it? So especially when you use uh a ALB application load balancer or like uh some uh WAV
Speaker 1: uh Well the not not doing the fireball. When when you use a fireball or like uh uh ALB loads do you use a Nginx? Do you put the Nginx in front of the GMCO
Speaker 5: Yes, so um uh one thing about uh maybe how how you do things, uh when when you're developing applications for for for the African market. most companies don't put in um a lot of consideration into maybe they they they don't put in a lot of uh budgets when it comes to uh to deployments and all that. So On on on my end what I normally do is I use of course I use G Unicorn and Nginx and and firewall. So I do all my load balancing on Nginx And of course how I I set up the maybe uh the cloud the cloud service that I use to do that.
Speaker 1: I say thank you. Thank you so much Uh so uh so when when you need to reduce your b bug budget, uh so you need to choice or like uh abstract which uh components you you use. So uh do you use uh some cloud services basically like AWS or like do you host on your uh own application by your server Which do you choose?
Speaker 5: So so uh mainly I I I I I do this from for my own servers, but uh uh at given times you use uh platforms like uh digital ocean and And uh and what's this called? Uh Linode , they know call themselves Akamai, but there's still uh there's still a lot of setup, manual setup that needs to be done to make sure that the server is is well structured for for performance and all that. So this again calls in for a lot of time and resources spent to to deploying a Django applications, making making sure that they are all uh fast and secure. So which is uh not something I look forward to, but uh it is what it is, so we use what you have. So um
Speaker 5: Cause says spinning up an uh a a cloud, uh maybe a virtual machine, configuring, you know, G Unicorn, Nginx, uh sometimes containerization if if I really do want it or if I re if it's actually needed and uh and then fingers crossed everything works well
Speaker 1: I see. Thank you. Uh Nanika, someone uh in the comments if you have some uh question, please write to uh uh chat. Uh I will read your comment. Is there any questions? So uh I I uh Ah so so so almost uh I remember it. And my question is that uh if you create uh some wave uh web applications by uh by putting a single page application and some APIs not like templating or something. So how do you make uh the caching
Speaker 1: Like it's templating is so quite easy or easy to understand. But uh when you use the when you create uh web service mainly via API So when where do you put the caching of layers like view or like DB access?
Speaker 5: Uh okay. So when you're just using things like uh say single page applications.
Speaker 1: Yes, yes.
Speaker 5: Uh that that that really relies on maybe lots of API calls. So um there are there are there are a couple of features that you can leverage from the browser itself especially that is if if users use Chrome a lot. Chrome has has made some some good some good updates when it comes to to machine learning and it can it can it can it can maybe it can detect when the next user or what the neck what the user is going to do next so it will on the back on the background it will pre-fetch all the resources and maybe just store them on the local cache. So that's automatically. But uh personally what I love doing is uh when when I'm when I'm doing especially SPS
Speaker 5: uh that does specific things, I do love to cash uh especially I I do love to cash uh what 's what we think uh a user will go to next after the initial page load. So and of course caching uh with SPH is mostly done on the on the local on the local local memory Which is again a very dangerous thing because uh the more caching you do, that means uh your your site is going to use uh lots of storage. and and and lots of lots of uh memory is going to be used uh potentially making your website slow again and then defeating the purpose of caching. So there are there are methods like uh preloading and pre-fetching. So I will use preloading to
Speaker 5: reload all the resources, maybe all the API responses. And then immediately a user or maybe a user just clicks to that resources it autom it instantly fetches the resources that are already pre pre pre already been preloaded. So there's no specific way that I would I would do uh caching especially with SPS because it's uh It's it's very opinionated. But uh I would most likely do preloading and pre-fetching on on on the resources. And they are they are very, very, very, very nice, uh, very nice techniques to do that.
Speaker 1: Uh
Speaker 5: you can use on hoover methods, let's say if if I if I use a hoover of an image or a link to resource, you can automatically start preloading that resources on the background without user you know uh actually going into into into the resource itself.
Speaker 1: I see thank you Thank you, thank you. It's it will be so quite so quick. It will be so quick. Like
Speaker 5: like
Speaker 1: clicking and the popping next pages is like magic.
Speaker 5: Yeah.
Speaker 1: Exactly. So it's
Speaker 5: It it would be like opening uh the next page in a PDF. It's already there, so just go and it's no. It's there, you don't need to wait
Speaker 1: Yeah, I noticed that in these days like Dev Doctor 2 is quite fast like like magical like lightning. Yeah
Speaker 5: So um yes, so so most for most websites or most web platforms are are moving towards instant loading. So instant of course is Very way better than than fast loading. So instant is just clicking and the resources appear. Click and these resources appear. But again this comes comes at a cost, a cost of memory, a cost of uh high internet bandwidth. That is if a user doesn't have all this, that's not going to happen.
Speaker 1: Mm, thank you. So uh the beginning of your talk that you talked about the business importance of the the response and the speed and i i do agree that part of that and it's really affects the business matters so but it's really it's The difficult thing is that people don't know that thing because uh uh yeah the optimizing is like uh hobby sometimes accepted but it's not And it's really, really important for a business, but how do you uh tell tell people especially of business people, um
Speaker 1: the importance of the the speed or like a response time
Speaker 5: so um I'll give I'll give uh a use case So in Kenya we have uh the government services are all access, uh either you can access them online using a government government portal or you can go to uh a government uh cyber cafe or centers so you can go access the services So of course the easiest option is going online. But uh when you go to when you go to these platforms online, it will take you around two minutes to log in alone. So that means you enter your email password or ID number and password, wait for the OTP and then get logged in, then now finally I you get
Speaker 5: you get into your dashboard. So um Many users get frustrated by this process, so they end up going to the physical the physical spaces. So you'll find out in as much as the government has online there are still thousands of people queuing up to access the same same services and access online. So give that that that expect that that use case scenario to people and do it to them if If it could take less than three seconds for these people to log in and get uh maybe their their licenses, there will be less people queuing up in the offices. Then of course uh you have to use you know uh that's that's uh a real guest thing so you just show them uh currently it takes two minutes and those two minutes they do look slow
Speaker 5: uh they It does look fast at some point, but we still have hundreds of people queuing up at a given moment to access these services again on the centers But if you do an optimization, so let's say if it takes even a minute less, there'll be less people on uh on the queues. That means they can get uh service fast online, so reducing the frustration So giving businesses these kind of examples makes them realize that uh it it it really matters. And then of course um in Kenya we have a lot of e-commerce platforms Uh that means even uh small businesses are resorting to selling the items online. But again, um the They they'll just get any developer building their website and that's it.
Speaker 5: But so again it it you find that it takes it takes you twenty twenty minutes to just order a cup of coffee. And it will take you maybe ten minutes to just walk into the shop, get your coffee done and walk out. So you still find more people walking into the shop than other than using the the the online platforms. But again, uh if we just show them if we reduce if we do uh maybe optimization XYZ that will potentially lower uh user user user interactions or maybe make speed up user interactions on a website you're going to serve more coffees online than uh you know on the stores
Speaker 1: Mm, that's great. That's great. So um yeah, Japan Japan do in Japan too the is there's gov government spot like uh Or like some paperwork through the web or something, but it's too slow and too difficult to to use it. So yeah, uh Mm in my in my in my cases too, I'm the tech people, but uh it's easy to send uh uh physical mail than using than using a papercy. It's really, really bad is interface. Sometimes, sometimes. In these days they make it better and better But yeah
Speaker 5: exactly. That
Speaker 1: that's it's really um easy to imagine that that uh Yeah, that description is really easy to understand for any people. Thank you so much.
Speaker 5: Yeah, exactly. I appreciate it.
Speaker 1: Hi, Hukani Simoa Gozai Maska Dzi Ariba Kaitik dasai Hi. Hi hi. Jack Korea or idea was gone. Is is it okay to end end this talk? Is it okay?
Speaker 5: Yeah, sure.
Speaker 1: Okay. Okay, say thank you for your presentation. Arigato Gozai Masta. Thank you so much.
Speaker 5: Awesome. Thank you so much. I appreciate your time and everything.
Speaker 1: Thank you
Speaker 1: A Django ninja, API Kai hat no core, replace no discent to you kotode, jugo de sang jugumbate has a kash, not send by nihilmas, it was called the first.
Speaker 6: Hi, a quote must redevelop. Yes, you can sista too, ma jango ninja , too. I present our hotel.
Speaker 6: And as you stake it already, not omittory must you're a scrolling ice must. I cover the guys a bit proud of the U to Pancho Locuster is October Devaz
Speaker 6: Mata kai satus te watis ne to pike to Python online action service that system kaihas notameno document service more kaihat un estorimas. Kuka se ne? Design producto no e to nayomo e tool So let's commit to Kaisa Motorimas.
Speaker 6: Ai. Apiongulotus dewa, jango ninjao, hatsi osta. It's a mlacade echo, Tori Kunda, representing the canto point to the attack , to Hokano Desney, I some API Kremlaku. So, we have to do this.
Speaker 6: kento syrukata. Mä ajattelin, että anteista ei pii kivanti , mutta meti rykkata tulla muomaan tarjotain aikana tuntemassa. Ai. Machango needs that to watch the words, eh? Ai. Mazukaio destiny. It's a too much API, you frame
Speaker 6: it, AQETA. Saisin vaan joa itten sankeina ukinnatukseen suutusten, vaan mä kain hintoa. Paidan tikkua, josta mä tein kensolatta, että ei keeminä ja kollaatikir. Documents , The Django already a success recreate. Matato are media to car, but jang on the middle, a jango jad saw the package yatari, a
Speaker 6: to shak ki cycing as new side dicta, a notayo mo Story boss. This I will need to get two users to
Speaker 6: use anything to end the point at response to katata. It 's a girl to end the point of success. Niin, tiesi ne, että tuo antaa syykintaa, että tuo
Speaker 6: Material is a resource, no Django moderate. This so it's going to be handy categories, eh? Matzigini, a to who na disiktor saw the party, to go, and to mummas. Scary T library. The Rujita I know south party library kit and state must be a Mataris, ne?
Speaker 6: What is akiholo, moderative view set to scalato, can't any baksukuret screened the Hanash Satamo the sketom But so that you have to go site to customize the staida, do we nano kaki? Hindi , this took skippywright like that. But that's you never know the
Speaker 6: top you know, they may tomorrow. Makanta sample colour sakoto ni chinka. So dokument spectacular. But if you're still the attarce responses,
Speaker 6: Ai. Ai. Made it to the video or suicide or yashikalato more than the scale.
Speaker 6: So, I think that's a good idea. Mahantai is me. Playing backwards with the day, but took this notion must say to watch good and I cannot get a rule must.
Speaker 6: But the too, it money is a interactive shadow. As you might say we got to go, it's next down the IKS could spot to that, who's in the video mode that could
Speaker 6: be a good idea. Hi , you're not hostile being about the sample Yangwanjadstum Hotondo need. Motamoto Haste piaino tiso nitti Case of state of so to Yango is o Kotundo, nigga tana toimas. What should I use a class on the past? Google is an ID study, user name cut ahead into the act that is the cutter
Speaker 6: stuff Yes, I want to get to use us. Y Christo es posol no categoría.
Speaker 6: In casting , to jamotuno. Him is a to go to the mo, but you don't have side not to it. connect Button yes.
Speaker 6: The Disney a kite for the business road , the way they go to the goal, is also side that you could be able to do this. Yes, I'm already this so right. I said couldn't have shortita.
Speaker 6: If that's a minimum, design du stick yet. API document.
Speaker 6: But you just have to do that. Customize the point of the point, that's the way, a cocoa by your internet , but you have to not tell this.
Speaker 6: Hi. But request response. So you bother a document to CSMIT , you 're sponsored
Speaker 6: , the attacker, content decision dexoka. I think that's a good idea. The API document. Hi.
Speaker 6: As I said top routine , okay. Okay, what are you doing?
Speaker 6: Passage , you can't see the path, it's all the kimas. Ai, we 're at this new kaštiki kitumon. Mazula, uh
Speaker 6: to kata hinto. The contradictory to staschema yigits new feed is the kumayana customize. Hi.
Speaker 6: But you would have to say must. Mazules, ne, to krass, India Mozilla , the feed of the schema to you know, importos temas. What's it up?
Speaker 6: To Python interpreter is costing it to use a ski bani at ID, it's your title modules there. But you just keep an ID , number one. So the Iraqis is on it. In the user schema ID, it's a
Speaker 6: youth. uh enable to pass string as in data different data pass the kina you need Yeah, hang up in Canada to Koroga, and Gazani would I do.
Speaker 6: So chasing the tokeny coto de your to kiss the kimas. Hi , I get on this ghetto design to use out to response.
Speaker 6: Ai, o If I'm going to be a little bit more than a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit of a little bit. Open PITIDA SEO MOTO DIA DO QUENTO DEATHOR THE WOULD THEY THEY THE LIGHT THE LIG Mä teet, että katsottu kai nicko tai systeem , kai teemassa. Mazala open APICO , end the point that endpoint the attack, parameter, oyes, or response auto destiny.
Speaker 6: Ne, PI dokument to you, mason shiva, se dokumentu yes ne. Hi. But it's say no, it 's weird, which you must. So I was on the design, a piano shadow kini, and we'll have sea.
Speaker 6: You also have stuff this gate of more. Documents , the same thing. She has moss.
Speaker 6: Hi, Danda Jiganakana , to Kantana. Customize the documents, eh? Document anymore.
Speaker 6: Ninja API class no hold ni et also no share, tell you select , and the point of ni, the ni so that was set in mass. But you just want to secure in the point of me. Ai. So the party that can be
Speaker 6: on this , you know, the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is that the other thing is. But Django Jai Novice,
Speaker 6: the party or kidnapped ecosystem in no teacher , you Ai, tiny up, page nation design. No, answer any decorator yos teamas.
Speaker 6: Stein is got the sketch.
Speaker 6: But some people know some pudu no ready, you are the spiny. Yeah, do that what's going on to day because we need to kind of this. Alright. My project. Guruze , I'll do my mass.
Speaker 6: Ei piä tuota paikka, että muun syrjinku sikastilmassa. Kosia GUD To pull this So, I think that's a good idea.
Speaker 6: What to all this new saigo? E pi aidotta painaka teapia jutott aturita. Tässä te ei ryuta usolutsi kastikuto te. I guess
Speaker 6: that you always know. So it got more hunastic tai not
Speaker 6: But there are no tests on this. Teston or the Costa End Point O, Ibas his rivers cancer de Patikalete Eh Design occurred. A continuaus got the sign in the point of taite a to response on height kit.
Speaker 6: But therefore today what we know you API high wang, a bazong it and dead and dead, you couldn't hide the sky. So the API button take this time to kidney , PI Kulasko, in susclusive, is again. No, endpoint is new document, endpoint of the circuit ,
Speaker 6: Take this again, still need to put a side. But there are API exceptional handler, it's a kushtag , a creative response to the response to Kaisuk, it 's looking as
Speaker 6: Ai. Saikin aitta tu antaa skelumin. But I'm going to cause you know that they create that , it cuts you to kill the discate of more. I guess we have to watch the moss.
Speaker 6: Aitto. Tuo ei voi henkilösti vapihua ja kun juonnat tästä on ainoastaan. I'm not going to do this.
Speaker 6: I'm not sure if you're not going to be able to do that. So this is the more buttons gas kills much. You can say through your state, is it go you'll be just it? Hi. The high system with a content question is a good idea. Hai. Tu sai koko kaki asinä nimestä.
Speaker 6: A jango ninja do you know, it to mitzvah arimasta. Ma set te data tari o arremosky business energeticos and the same.
Speaker 6: Tieto promotegistan otsikka stekkimassa. Yes, I would say the use case. State that you talks on the community that eatatolo macuda. Hi, asanko you are document , you must be a good idea.
Speaker 6: Hi , people are higher day, say this was it to anything.
Speaker 1: Hi Arigato Zai Masta Hippo Sanji B. Discord to the key to the kid.
Speaker 6: Aye, Ariatoko day must uh
Speaker 6: Hi
Speaker 1: Umata Zitamasha Itashimasta, thank you for waiting. The next talk is implementing Agentic AI solutions in Django from Scratch via Mr. Craig West. Uh so can you start to your presentation please?
Speaker 7: Yes, thank you very much. Well welcome everyone. I hope you're enjoying the Congress and there's been a lot of work that people have done for this, so I thank them for that
Speaker 1: Thank you, dude.
Speaker 7: I've got a very detailed repo which we're going to go through and will provide kind of references for the future. So you can get the repo from this link here. Or directly here. So if you go to pytest-cookbook. com, you'll basically then come to this. Let me just come up here. Talks. You should see on the main page. The link here, we click on that, and then you will get the repo. If you download that, what you'll find is as I'm giving the talk I'm using almost a transcript that I use for myself that's in Markdown. You can obviously open that in preview mode if you want. But also there is a notes.
Speaker 7: html which when we open that up is basically going to be what you're seeing here Let me just take that. Sorry about that. You'll basically then see this here, and if we come back, you'll see this is what I'm using in an HTML version. So everything you need is in here. It's fully documented. It's almost like a mini workshop because we're going to go through the code and actually understand how things work. So who am I very quickly? I'm just one of us, a regular Pythonista that's learning to get to grips with the new technologies. And as somebody once said it doesn't get any easier, just different. I was basically an information architect in the early 2000s and returned in 2017 via WordPress and JavaScript.
Speaker 7: And I'm currently developing my AI-powered knowledge systems workbook that's available here on the links. I live in Brighton, UK, right at the bottom of England, and that's our lovely beach I'm a volunteer coach at Cobar. io Brighton, which I find very rewarding. And I've just got myself a new red fox Labrador, Leo. And where I live, there is actually a red fox that seems to be quite mesmerized by Leo. We have about three of these local foxes. And my first computer was in 1979, a paper -tape reader. And this was really cut and paste was cut and paste. So let's get into AI agents. What is the definition?
Speaker 7: Well there are many different definitions, but the one I think I like is that from anthropic which is where LLMs dynamically direct their own processes, their own path through the app, and maintaining control over the task they accomplish. Or as Hugging Face says Their programs were LLMs outputs control the workflow. Now If we look at this agent's AI directory, we will see that there's over a thousand different frameworks. And libraries available for AI agents. And when I started looking at this in January, it was about 700. So it can be very overwhelming to understand which framework we should use and how we should use them
Speaker 7: So that's why the aim of this is to really understand, to demystify and simplify agents so that we know how we can make them from scratch simple versions that then when we use frameworks we can then begin to appreciate and understand them so much better Now because we're going to be going through workbooks and seeing examples, my suggestion is you don't get too focused on the code and understanding each line Try and see from a high-level overview what's going on because there's a sudden shift in paradigm with agentic programming We're going to use notebooks, but I've also got a demonstration of Django so that you can see how to transfer the notebook code into your Django.
Speaker 7: It's literally a copy and paste, it's the same code And so what's actually happening with agentic AI? Well, imagine you turn your mouse around 180 degrees It's exactly the same actions, left, right, up, down, but it can seem quite foreign and it can seem quite unnatural, and it can take a little while to get used to that. And that's the metaphor I use with AI agents. Now with AI agents, there are kind of three aspects that come into play. Firstly, there's only ever one endpoint. But if we want to create new API endpoints to do different things, we kind of create it on the client side and post it up with our request. That seems a little bit strange.
Speaker 7: The second thing is we use natural stroke human language, in my case English, to write the code of that API. And we'll see that in the examples. And thirdly, there's a sense of autonomy, because although we may know the overall structure and flow of our app, for example, the route it will take is determined by the LLM. And we're going to see simple building blocks of this as we work through the notebooks. And for this talk, I like to just use the term function in the mathematical sense rather than just the death. as in Python, but it could be a class or something else. But basically it's something that takes in an input that then produces an output that can be chained into another response and to another query to get a new response back
Speaker 7: So it's method chaining, so that with each agent, for example, the output of one agent can feed into another agent. Now before we actually go into the code, let's just have a quick refresher on how we make an API request. to an endpoint. Now for example with our LLM we will select a model and notice here how we have just the one endpoint We obviously have to send our API key. It contains information about who we are, but notice there's no reference to previous conversations or previous queries. It is stateless We'll pass up a payload, we'll examine that later.
Speaker 7: And then, for example, using the requests library, we use our URL, our headers, and our data to send to the LLM. So the key takeaway is that there is only one endpoint and we don't use other endpoints for different tasks. Just the one endpoint where we actually send up the kind of code for that endpoint from the client. that the LLM then works on and produces our result. And it's also worth refreshing our memory that actually we only get a text response back Text goes to the LM, text comes back. So let's go into the notebook now and see this very first example.
Speaker 7: And what I'm going to do is come into here. Let's go into this very first notebook. Open API with requests. And this is just going to be the building blocks for how we make requests so that we can use them in the future. I'm loading in requests, I'm loading in our environment variables, and for example, I've given you a sample. env sample. Obviously, rename that to. env with your own key. That's mine there. And for example, when we run this, we can actually see that we're just getting the key that we've used.
Speaker 7: We're selecting our model. And what we're going to do now is just for an example, we won't use this in future notebooks because we'll be using some open a open AI library. But basically, we're setting a request To this one endpoint, we're passing in our bearer key. We're using a little function to generate text. We're sending in a lot of messages. We're going to explain this later. And we get our response back. So if we instantiate that class For example, an ask a system prompt, give a concise answer to questions with no more than 100 characters, and we use that class to basically ask a question, we will get a response.
Speaker 7: And we can get the actual final content through working through the output that we got back. But we can backtrack to see different examples of this. For example, if we do this and change here. We can see what we actually get back, how I'm extracting the content. Now, this is just to show that when we actually do our requests, we only ever go to one endpoint. And if we want to do something more complex, we need to ship that up in our prompt. So let's have a look at that in the second notebook where we're now in the API. We're going to use some of the libraries from OpenAI. I'm using Rich
Speaker 7: Console for formatting And for example, we know how we can make requests to an API. For example, a joke API here. We just make request. get, we get a random joke. But let's say we want to do something a little bit more adventurous. Again, we're loading in our model And we now set up a list of messages that will pass together to the endpoint to get our response so that we get something different back. So for example, I'm defining the background of the AI agent. I'm saying it's an assistant at great at telling jokes. And this is where the prompt engineering term that you may have heard comes in. We're adding in extra information.
Speaker 7: This effectively is our endpoint, which when we do our regular Python programming would be a different route. But remember, we just have one route to the OpenAI in this example So we now have to kind of code up some sort of endpoint. So we basically, it's almost like setting up a job description We say you're we're saying that a joke worthy of publishing must have a rating of 8. 5 out of ten. We want the LLM to judge the joke. We say that if it's not worthy of publishing to return in a next key, retry, but if it is, publish.
Speaker 7: We'll see this come up shortly We also give it an example. This is what we would expect to see coming back, the setup line, the punchline, the rating, and whether to publish or retry. We may add in some additional information to clear back ticks, for example, depending on what's happening. And we also say please ensure jokes are not repeated on retries. So we load all of that up into our system message. We have our user prompt, tell a light hearted joke for audience of Pythonists. And because OpenAI has been trained in a certain way, we send up a list of these messages to the LLM.
Speaker 7: And when we get that all back, what we will notice is that we will actually get that JSON object back that we asked for. And in this example, the rating was 8. 7, and the next was published. So, what can be useful is if we wanted to have an application that kind of keep track of sort of a state object of what to do next. So, for example, we could create a state object. And we can basically add all of that into the state So that we can then work on our next step. So as we go through here, for example, having gone through all of that, we can establish that what the app
Speaker 7: should do is go to publish. It's almost like an if-else. So basically we loaded the response and we then say if the result next is published, load all of this up If it wasn't, it must be retry. The next step must be a retry. So we can see in this example how we've sort of created an endpoint that takes a prompt, tell me a joke. It then rates it, returns a joke, and actually determines in this instance whether it should be published or not. Now this is not an example that we maybe use in production, but it's outlining how we're getting a flow being determined by the LLM. It is the LLM that is determining whether we should publish or retry.
Speaker 7: So that essentially is the two very important files because they give us the basics of what's actually happening. In the very first one, we see that we're using one endpoint only and that basically we pass up the messages And we can get a content back. In the second one, we can see how we've asked the LLN to do something We defined its expertise. We've just given a job description effectively of what it should do at work. How it should basically return a joke, but also kind of rate it and also determine that if it's more than 8.
Speaker 7: 5 out of 10, that it should be published as opposed to being retried. So with that, we can start to use these principles to help us do something useful in our apps and in Django. So in this example, we're going to sort of see how we almost got an example of RAG, retrieval augmented generation. Rag isn't just about asking questions on documents using vector search. It's about supplementing the prompt that we send to the LEM with factual knowledge, with more context. So we're going to create a little chatbot that with some information that we've drawn from, for example, our database, can answer questions.
Speaker 7: So once again, we've basically seen that we import OpenAI. I'm going to use Grajo just as a utility in this notebook, but after this, we'll see Django using this. So we get our API key, we get our model and client. And we can also send the previous messages in history so that the App has context of what went on before. Remember the the endpoint doesn't when we send a request it is stateless. It has no knowledge of what went on before unless we tell it. So we send the system role, the system message, we send our user question, and we also keep track of the history to put it in so it has previous knowledge
Speaker 7: So, what are we defining for this? We're telling the system prompt you're a helpful assistant for a shoe store. And if a user asks a question, be as helpful as possible, be verbose, be suggestive. And what we're going to do, imagine we've drawn information either from the database or from files, of like an FAQ. Now what we're learning really is how we can use agents to help with search, the help function, or FAQ. To add some AI to our apps to make it AI-based without it having to be fully AI. We can use AI agents as just endpoints, just functions within our app. So we've got a list of facts, and I'm keeping it very simple. We sell shoes, opening ours, VAT, we only accept card payments.
Speaker 7: And we join all of that up. And if I now go to the If I now go to the gradio, let me open this up. Yeah, pardon me, let me just If I say red shoes, I don't even have to do red shoes, Sunday, Cash You can see it's processing it, sending it back, and straight away it's giving us an answer. Now to implement this functionality,
Speaker 7: without an LLM would be a task in itself. But notice how it picked up car we only accept car payments, etc. So I could do something like skirts Now, the takeaway from this is that how it's been possible to create something quite sophisticated in a very simple way by providing specific context. The rag aspect as it were, the knowledge , and basically creating our endpoint And sending the message up. So when we want to implement agents, say in our Django apps, we can actually Add in some quite advanced features in quite a simple way.
Speaker 7: This is the way of using FAQ to give a chatbot. And what I'm going to do now is actually show that in Django itself So the Django app is here. I've got two apps. I'm gonna start with the chatbot one example, and then there's a chatbot app here, which is a slightly different look But if we actually go into this chatbot and we go into our views, we can see that the implementation is just the same as we saw in the notebook We loaded in our keys. This was literally a copy and paste, the system message, the FAQ, all of this. I need to ask OpenAI, so now I'm just refactoring it. But this is the key part here, the system message.
Speaker 7: And basically when we come through here, we're just returning all of this information in the request and using a chat. Template. But basically just lists out all the elements and just has a bit of JavaScript to basically Make it more useful. So let's go away from here. So we've seen that. So we can ask that same question. And what I'm going to do is bring that here A bit a bit smaller. So red skirts, Sunday cash And straight away we can see the answers coming back.
Speaker 7: The second example is basically just an implementation with HTMX, which is in the repo. But what I wanted to show you was that to implement what we saw in our notebook is relatively straightforward in Django We may refactor it out, but the core code is the same. It's sending a request to the LLM endpoint with a detailed system message of the nature of the agent, what it does, some examples, what you would like Very much as if you're writing pseudocode or if you're giving a job description for somebody new that's starting your company, this is how we do things. And this example here is just a slightly different presentation, but it's exactly the same.
Speaker 7: Red Skirt, Sunday Cash, for example. Slightly different format, but it's the same. Now to implement this in your Django apps, if clients need you to do something that's AI, so that that's the whole range, you can see that you can very quickly implement chatbots or other types of agentic behavior without too much difficulty So that's the FAQ. Very handy. Straight away you could put that in a Django app and you could obviously change the UI, make it on the side like you see on most websites, or you may print it out in a different way. But hopefully this is showing that agents
Speaker 7: are just regular Python with an API call. The difference being that if we want it to do something, we don't make an endpoint on the server side We sort of script it on the client side, send that and our prompt and our context up to the LLM and we get a response back. So for example, I if I'm asking a question like where are you? It's picked it up very well. And we can change the nature of the agent. We said be very verbose and persuasive. You could may say be very curt. And change the nature of the response. Because when we come back here, when we actually see in that route
Speaker 7: FAQ, when we come to our system message, Here we can change whether it's suggestive or not. You can you can say it's more of an expert. You could sort of say you could even in a different language. What we have seen that we can implement agents into our Django app with some small, fairly straightforward code once one understands it. So one of the things I wanted to emphasize in this talk Is it could seem that agentic programming, agentic AI in apps, is something very different, something very complex, something that is either fully AI or not.
Speaker 7: Here we've seen an example that we're using traditional Python, if I can use that term, but we can add in little bits of AI where useful. And so in essence, AI agents are Python code with API requests to LLMs. We can only pass string, a text into the API. But in that string we can create a job description, a sort of code of what we would normally put into our endpoint For example, if we've seen in FastAPI or Ninja in previous talks, we might have to code that up on the server side. Here we're sort of coding it up in our natural language, English or Japanese, depending on one's mother tongue, language that one's using. So for example, we will say to the LLM, this is your role, this is what you do, these are the tools you have, and we're going to come on to tools
Speaker 7: And here is the data to work on. We sent up some context, like in that example of the FAQ. And this is an example of prompt engineering, or as the new term people call flow engineering. And how we make use of this in terms of design patterns is then day-to-day Python. If we've got many different agents, we may blend them in different ways, in the same way that these are the design patterns when we've got lots of classes and functions in our app. How we handle all of these different classes and functions is the design pattern. So our AI agent is a function in the mathematical sense, something that accepts inputs, performs some LLM magic, and returns output.
Speaker 7: So let's extend that example of the FAQ. It's exactly the same as before We're loading and stuff. The difference is, is as an example, we're saying, what if you're a report agent? And this example came up from when I was working in Cobar as a volunteer coach. Somebody said to me that they wanted to get a job in AI in Python and I asked them do you have an AI department in your company? And they said no. So I said, well, what is it you do? And they said, well, they run reports, different reports, that people ask for. They're basically either go-to person that will select the right report and run it. So I thought you could make that AI. You could replicate yourself so that when you're away, that they could basically ask an LLM and ask a little app to do that for them.
Speaker 7: So how might we do that? Well, once again we set up, and when we say system message, it's just a variable. What we're doing is we're listing all our information and then we supply it But because OpenAI likes to have a system message for the system and a user message for the user, we kind of keep them split. But basically the variable name doesn't matter, it's just going to be put into the API We're saying that this is a report selection agent. We're saying you're very good at returning the best report to answer users' question. We give an example. For example, if they want a joke, you reply with, and I'm just using this format just to show how we do it because we may want to strip if we're getting lots of uh answers back we may want to strip so I'm putting in a pipe to help with kind of for example
Speaker 7: stripping it into its elements. Or another example is if they want total sales report, then the tool would be the get sales report. Tool get sales report So like the FAQ for example, I basically made a list, very basic, for whether tool use this. How I write this doesn't matter, but so long as it's clear and consistent, the LLM will understand it So for weather, use the and they're gonna it's going to return sort of in these double asterisks just for demonstration purposes. Booking tool, car hire, flight, etc. And in the same way, we join that system message with this information here, reports. And once again, when we've set that up, we can see it in gradio
Speaker 7: So, flight, let's come in here and say, for example, not even flight, plane to Paris. It's straight away it's found that it needs the tool get flight. It's kind of worked out what the next step would be. We haven't used that yet, but we're basically beginning to determine the path. So what if we said plane to Paris, auto to Rome? It's determining each of these and because we've deliberated this, we would be able to extract out each individual tool. This is more Python rather than AI. So straight away this is a way that this chap could have basically made an app that replicated
Speaker 7: What he does by basically having a form with start dates, end dates, and rather than somebody having to pick from a drop-down list a particular report, someone may not know which report they need. There may be lots of them They could type in their natural language what they're looking for. The LLM would determine which tool or which report would be needed, it will also have the structured input of the dates and it could run that for them and email it to them or print it out in the PDF or just display it on a page. So again, looking at the code, when we want to implement some agents in Django, we can see that really the AI part is kind of basically
Speaker 7: This bit here where we're doing the programming. We're setting up what it should do. This is our endpoint on the client side, written in natural language. We send up Information that we need to add to it so it not knows what to work with. We've given it examples. So therefore, when we actually ask for the report, we will get the right report coming back. So, using this, what else can we do? And I've left all this information in here with a lot of code explanations. So that afterwards you can work through it if you want to.
Speaker 7: Because it does take a little while, it took me a little while to kind of get to grips with the new paradigm But what I'd like you to focus on is the high-level overview of what's going on. Because really it is just Python, but it's Python with an API request to an LLM, but done in a certain way on the client side. So for example, one thing that agents may need to do, and you hear that about tools. Okay, they can give a response back, but what if they need to call a tool to do something? In the same way, we can create an agent that determines what tool it should use to solve queries. Again, we're setting up an example of tools. We're saying in this example that you have two tools
Speaker 7: A calculator tool, and we're giving an example of what we would expect back. We'd expect that the next thing it should do is it do calculation. That's one of the functions that we've got, and also what arguments it would need and for example the numbers and the addition if it needs to tell a joke it will come back with what to do next do the joke function and return the answer So let's go up and just very quickly as we scroll down We can see that when we get the response back, if it contained do calculation We would then be able to extract out from the response, which we're going to see when we run this.
Speaker 7: We're going to then be able to get the arguments from the output, and we could then run some functions, some code. To give us more information. This is how an agent can know what tool to use and how it can extract the information so that it can run it. So let's go up again and let's run this from scratch. Run all. We're loading in. We've got our key. We've set up our system message. We've said in this example, our user prompt, what is 102 plus 3? So we send up the system message, which was the coding here. We send up our user prompt. We use the chat completions of OpenAI.
Speaker 7: And when we do this, it comes back with this answer. It says the tool I need to use is the calculator tool. The function name is the do calculation. And it's extracted out the arguments of 102 and 3 and the operation of addition. So we can strip all of that out. We can do the calculation. So with that object that we've got back, once we know what the next is, we can basically determine that if it's the due calculation, we can extract all the information to get the answer. If it said do joke, we would get a joke back. So let's go back up and change the prompt. So straight away, this is how it's determining what to do.
Speaker 7: If we run this, we run it all. It determined that it's a joke, that the kind of next function should be do joke. That's just a variable we're keeping in our state object We strip all of that information out so we know the tool, we know the next, we know the audience. It's not a calculation, do calculations not present in next? But do joke is. So we can run a joke and we get the answer here So tool calling is an example of how we can determine the AI agent can determine what tool to call and it can also extract out the arguments and then run the function.
Speaker 7: And one thing that concerned me is, well, where is the function run? Is it run on the LLM side? Is it run on our own box? And from the OpenAI website. it actually gives us the answer that your application executes the arguments. So there's a toing and froing between our code and the LLM. Once we get back what function we need to call and what are the arguments, we run it, we get an answer, and we can then send it back if necessary to the LLM for further work. And I just wanted to sort of remind ourselves that actually when we're doing this, when we get a response back, shall we say, from that calculation. We may
Speaker 7: send a new response to do something with it. We get the response and a new query, we send it to the LM, we get a different response. So this is what we will see later on when we have a loop where it can go through and basically keep adding new information to the history. Pass the history up to the LLM because it's stateless, it doesn't remember what went on in the previous query, and keep performing further work. Now, the example that demonstrates this well is a so-called planning agent. Now, there's not a difficult code here, but to go through it line by line won't work. So let's just look at the overview of what we're doing.
Speaker 7: We're setting up an agent in the usual way We're pending when we call it, we're pending the messages as we're getting them, and we execute the LLM with the previous knowledge added in, sending it up to the LLM. And this is what's called the react pattern, reasoning and act. Basically we're telling it That you're running in a loop and you think about something, you determine an action, you create an observation and go back through. And in this example, we're expressing two tools. calculate total and get product price. So we're going to say we're going to ask for what is the total price of a
Speaker 7: say a laptop. It's got to find the price of the laptop and it's also got to work out what the total will be by adding some tax. So it's going to run once, get some information. If it feels it has the answer, it will print back answer. Otherwise it will go through. So we're giving it examples of, for example, get product price of a bike. We're telling it which function to use, if the bike is at, we're giving it examples of what to return, the result. the function and what to do next. We usually say pause as it's going through the loop so that we can pick it up. So let's give it an example of an example session. We're going to ask what's the total cost of a bike including value added tax What it's going to see in the response as an example
Speaker 7: is there's a thought, I need to find the cost of the bike, the action, and I'm using a pipe delimiter so I can split things out. Get product price, that's the function I'm going to need. And what's the argument? Bike. You will be caught again with the result of this as an observation. We're going to pass observation back in with the result For example, like this in our code to get another response back. And it will say I need to calculate the total including the VAT The action needed is calculate total and what do I need to pass in? 200. We're giving it an example code of what it might see. We also tell it that if you have if you think you have the answer, you then output the answer in this format.
Speaker 7: Now let's run the code because it'll be more obvious what's actually happening. So I'm going to run the code up here. So it's starting the loop. It's determined that it needs to find the cost of the bike. So it uses the action that's to get the product price function. We need the argument of a bike. And it prints out the observation is 100. That gets fed through again. It now thinks I need to calculate the total, including VAT. The action is calculate total, works out the answer, and returns in this format, answer the price of the bike including the AT is 120. And of course with Python we can extract out exactly what we need.
Speaker 7: So let's have a little look now of a high-level overview of what's actually going on. We've got a function, calculates total, we've got a way of determining a product. We're basically just going to keep looping round and round. The AI bit is here where we send the next prompt every time. Because if we get an action, we're going to split it all up to get the next function to use, the next set of arguments. Run it and then spit out observation with the result that goes back into the loop until eventually we come up with an answer that if there's answer in the result, if it prints back the answer, which we saw here
Speaker 7: Answer found, it produces it there. Then what we can basically do is print the final result. So I've got two versions of this for you. I've got one with the notebook that basically goes step by step and kind of explains exactly how this happens. But really what we've got to remember is we have two functions that we're saying that when you determine that you need to use one of them, use them, return the result with in the form of an observation. And then basically if you feel you have the answer, break out of the loop and return us the answer. So, what we've seen here, and I can appreciate it's quite difficult to follow all of this.
Speaker 7: It took me quite a few iterations to actually grasp this. What I'd like us to remember Is that basically we're having to learn a slightly different paradigm. We're used to having endpoints created on the server and we use a different endpoint with the variables or arguments to get some feedback. However, in agentic AI, what we do is as there's only ever one endpoint, we have to kind of create the endpoint by writing up some code. It's going to be pseudocode, it's going to be a natural language. that explains exactly what we want done and when it comes back
Speaker 7: we have the options based on the results and what we've asked for back because as we saw like with the joke example we not only just wanted a joke but we wanted a rating And an idea from the LLM, what should be the next step? Should it be to publish or should it be to try again because it's not a good enough joke? So we have client-side creation of endpoints, we have natural language, and we also have autonomy. That while we know the overall beginning and end of the app, the route that it takes is determined by the LLM if we so choose. And what's important for us just to refresh our memory Is that basically when we have our query, we're constantly adding more and more messages into the query, sending the previous responses back up to the API.
Speaker 7: So that it has a history of what's gone on and it can determine that. And we saw that in the FAQ, we've seen that in the tool selection. So as we're coming to the end now, this has been to kind of give an overview of what AI agents are. When you want to learn more in detail, this repo has all the information that I've gone through and all the code samples. So that you can work, and a few extra ones that we didn't quite get into. They will actually explain how you can use AI agents from scratch, how you can use them in Django, but more importantly now that when one understands how to make them from scratch, When you want to use libraries, you'll have a deeper appreciation and understanding of that. And you'll probably end up going to use libraries, but at least you'll know how they're working under the hood
Speaker 7: And some useful libraries if we come on down all the way to the end Pydantic AI and Hugging Face are more like libraries, they're small building blocks that you build your kind of flow and framework around them. Other ones like crew swarms and And uh Langchain, Lang Graph are more frameworks that have lots more features for you to use. So very complex all of this The main idea was to produce a nice repo workshop that you can take away with examples and build your own agents from scratch or understand Agentic AI in greater detail and depth. And
Speaker 7: if you have any questions, there won't be time for questions. Please do free to contact me on the link at the Pi Test Cookbook. Down here, contact. There's the email or my LinkedIn. I can happily go through things. And as AI is all the rage now, as a developer, if a client wants you to have some AI in your app, you can very easily introduce, for example, that FAQ chatbot, and now you have an AI-based. application. Thank you so found for bearing with me and uh that's the end of my talk. Thank you
Speaker 1: Thank you for making awesome presentation, Mr. Craig. So uh we have the two minutes remain. So uh is uh do you have the chat? Do you have any questions? Uh Uh I have question that uh uh so for example uh so when you uh writing some prompt for for AI for a AI so sometimes it's difficult to uh to return uh to make to make AI to return a correct response, like like it's sometimes to respond uh other things or like a not correct forward. How do you optimize your prompt?
Speaker 7: Very good question. It's all about structured output. In this talk, we didn't go through that, but for example, most libraries use Pydentic.
Speaker 1: Yes it is
Speaker 7: Pydentic authors come up with Pydentic II.
Speaker 1: Oh yes yes.
Speaker 7: When you do that it everything has classes so we've we're familiar with Pydentic in Python. If you start using something like Pydentic to structure your output and put it in, the examples are very well explained in Pydentic AI. We didn't go into that, but it's a very good question because that's the problem. If you're chaining functions, how do you make sure that you have the right kind of output in the right format for the next input? And Pydentic AI is a very good way to start off understanding that.
Speaker 1: Thank you so much. I will try the Bydatic AI. Thank you so much Um uh it's uh for film and uh 30 so that uh again thank you for that Mr. Craig uh making an awesome presentation.
Speaker 7: Thank you so much.
Speaker 1: Thank you so much.
Speaker 7: Bye-bye everyone
Speaker 1: Uh thank you for uh waiting everybody. The last talk is uh diving into D SL. Django Software Foundation Governance Past, Present and Future by Sarah. So can you start your presentation, Sarah?
Speaker 8: Sure. Thank you for introducing. So today I will talk about Django governance and I would like to thank the organizer for doing this conference and thank you for having me first. So let's talk a bit. Thank you. Let's talk a bit about me first. So I guess many people might not know me. So I'm Sarah Abdelman. I'm a software engineer based in France. I work for Kraken Tech. some some of you might know this company and uh I'm almost everywhere on social media I have a blog uh which is sarahabidi. com and I'm thinking I'm the work person to talk to you about the Django Software Foundation because I'm a board member since 2024
Speaker 8: and vice president since January. I'm also a Django accessibility team member and I co-founded with friends a Django Notespace program. It's a mentorship program that uh Priya did talk uh before so if you would like to know more you can check that and uh let's talk a bit more about the Django governance, but first I would like to give you a bit of history of it. So Before uh to have the foundation there was uh two folks who was uh um talking about like the
Speaker 8: decision and make the choice, which was a BDFL, which means benevolent detector for life. So it's originally used by the Python creator Guido van Welshen. And uh there was two people, so Adrian that you can see in the left uh in the image and Jacob uh who is in the in the right So this picture dates uh because it was uh created in uh it was done in 2018. Um so yeah. And um they they create like the the framework and um after that uh they decided that uh they have to retire because uh it's a lot of work to decide everything
Speaker 8: and there was a lot of people who are contributing so they create the Django Software Foundation in June 2018 and started to search for uh support from uh from community and uh funding. So it's beginning to be the Django Software Foundation, which is also called DSF. So it's the development of Django, which is supported by an independent foundation, which is a non-profit one. It was created in the US So the goal of the foundation is to promote, support and advance its open source project. So this is nice. So we have like an organization who handle
Speaker 8: like everything which is related to non-technical stuff. But to be able to have processes for the community because the BDFL uh decided a lot of stuff, but at some point they retired in 2014. So they decided to create what we call the Django enhancement proposals, so the depth in short. It's documents that specify the Django governance and the major changes. It's a bit same as a Python pet if you are aware of. So it's a way to define process for the community to work and propose any changes. So there was a few depth if you would like to check out. It's on the GitHub repository
Speaker 8: Django depth And uh the first one was to define this process. Uh so how do you how do you propose something? And uh the Most major one was step 10, which specifies the organizational structure and all the rules for voting, etc. So from an organization point of view, uh before Deb10, there was uh the two BDFL I mentioned before. for uh all the decision to made and there was the core developers which was nominated to be part of the team in function of their contribution So there was two types of core developers. So there was the core committers who really commit to the code
Speaker 8: and the core merger who merge the code. So then technically there was doing that, but they was doing a lot of stuff, which is uh, for example, on the uh Tree as a ticket and stuff like that. So before depth then it was like that, but they changed it to uh have more process for a better gestion. So it began like that. So we have the DSF, which is also for the non-technical issue and all the legal and support entity. We have the technical board which is handling all the technical issues and the vision and guides the Django's feature. And we have like the mergers
Speaker 8: who handle all the merge to the code, the releasers who are more about checking for the timeline for the release and if there are any issues related. and the triage and review team, which is uh triage in the ticket, but I would like to say more. uh more like uh review the ticket, change the state, if it's an accepted ticket or not, why is there missing in any information So if we take like a global look, so we have the DSF, which is like the board of directors, we have the technical board. Under the technical board, you have a lot of technical team like the security team.
Speaker 8: And you have also a special committee to handle specific tasks. So you have the Code of Conduct Committee for the violation and any report related to the Django code of convict. And you have the fellowship committee For the fellowship program. The fellowship program is folks who are working on Django day by day. It was created in 2014. And the fellowship committee essentially selects the candidate to fill the fellowship group and act as line manager during the operation of the fellowships So this is how it was uh
Speaker 8: uh how it involved and I will talk about more how it is uh now. Um so uh I thought uh it's like slightly the same but there is like some uh changes so if I retake the goals as I mentioned before So the foundation supports the development of Django by sponsoring sprints, meetups, gathering and community events. For those who don't know Sprints, it's a group of people who worked on a topic together to make open source contribution. And generally it's a product someone bring on and they work together and most of the time it's physically.
Speaker 8: There is also the promotion of the use of Django around the world. And the protection of the intellectual property for the framework's long-term viability, which means protection about the trademark of Django. since this register to avoid like misuse of the name and advance the state of the art in web development. So I I said that the DSF is a board of directors. So the board of directors right now is uh we have like seven directors And four officer role. The four officer roles
Speaker 8: are president, vice president, secretary, and treasurer. And we have an assistant of the treasurer, which is Catherine on the picture, who works with all the sponsors. And uh prior um 2050, uh the board of directors was not uh annually elected, it was member which was added or removed as required. Right now it's uh an election by the DSF members. I will talk about them later. Uh and uh Each director has two term years and they can reapply if they want to stay in the board
Speaker 8: So the the DSF was announced in 2008 and the officer role was added also in 2008 but in September, like a few months later. So currently the president is Thiba, the vice president is me , Tom is the secretary and Jacob the Treasurer, and we have also Abigail, Jeff and Paolo as other members of the board. As I was mentioned, there is the Django Fellows, which are part of the Fellowship Program. Its page contractor worked and maintained day-by-day Django to keep the project healthy.
Speaker 8: So the the fellowship program was launched in to uh 2014. It was a pilot at the beginning and then it was funded to create uh the program to see if it's a successful one and since it was a successful one it was kept until now Right now it's uh Sarah and Natalia who are working uh on Django day by day and thank them. Um so the Fellowship Committee, which is now a fellowship working group, it's change a name and slightly how it's working. And they manage a fellowship program to review application and acting as HR for the fellows. So I mentioned the DSF working groups.
Speaker 8: So the working groups are groups of people who work together on a specific topic. And they have uh they have they act uh on the behalf of the of the board. Usually there is a board of liaison which is a board member, which is part of the group. So there is a direct relationship with the board in case of special requests, uh, I don't know, like for example, budget or And there is a way also to report to the board so the board can see how it's evolving and can do also a report on their own about all related to Django. So currently we have the Fellowship Working Group, the Code of Conduct Working Group, Social Media
Speaker 8: Working Group, DjangoCon Europe Support Working Group, and fundraising. You may wondering why there is a DjangoCon Europe Support Working Group. It's because since it's gathering a lot of countries in Europe, it's hard to handle the way to to create um how do you say that um to do the organize an event and uh this way it uh helps to to organize it in a way it's sustainable. Sorry. So so yeah, this is it. And I hope there will be other working groups soon-ish.
Speaker 8: So outside of that there is DSF teams. The DSF teams are working differently. There is No board related in that, since it's not needed. But the people who are part of a team are generally invited. So there is the steering council, which was formerly the technical board. You have the mergers who review merge other PRs, but they can't merge their own code. You have the revisor who care about the process of release and the timing of the version. And also the accessibility team, the ops team, which is also called the operation team, to
Speaker 8: to uh care about all the infrastructure. You have the security team for any issues related to security, and you have the triage and review team So I was saying before that uh the board of director is elected by members And the DSF members are usually called like that because it's individual members, but we also have we have like two types of membership. The first one is the individual members They are appointed to the Django Software Foundation in recognition of their contribution to the community. It can be different types of contribution. could be contribution to code, contribution to an external package,
Speaker 8: moderate the forum or Discord. uh various ways uh you you can contribute and there is the corporate members so the corporate members uh are designed to give a voice to the organization interested in supporting and sponsoring Django 's continuous development. So if we talk about more the individual members that are appointed for their contribution as I mentioned, so it can be really various ways of contribute, can be like, for example, organizing an event like this one. And if you would like to learn more about I put a QR code and also the link below. The benefit of being
Speaker 8: individual members is uh you get to vote in a DSF election. Uh which means uh elect the board of directors, but also the steering council, which is also uh elected by DSF members. Get access to private DSF members forum and private Discord channels. And the DSF memberships serve also as a way to be uh advice council for the board and also a way to exchange between the active contributor uh on their own Oh, I just forgot to mention that if you think that you might be individual members, please you can apply.
Speaker 8: There is the link of the form in the page. So there is also the corporate members. This is the major donation we have for the foundation. So I put the logo of all the current donors we have this year. So the corporate members uh uh give few packages. So we have the platinum, the gold, silver and bronze. So it not it doesn't give the same uh amount of visibility uh on the on Django social media and websites. And this is a good way to give back to the community and help Django development. So
Speaker 8: if you know a company which is not on this slide and you would like to be on it Please check this QR code which is right here. So the benefit is to participate in the membership and the foundation discussion An organization description on the corporate members page and the logo and link in the fundraising page So you can find out with the current code. But you can also see the link which is foundation slash corporate dash membership And if we talked about all the donors we have, so we get uh the major uh donation from the corporate members.
Speaker 8: But we also have like donation from individuals. You can donate through the website or through um GitHub sponsors. And there is also sales, which means uh We have a merchandise shop. So you can buy t-shirts or merks and stuff like that. It's on our website in the footer. And um so this is the income we get with all of that. And as you can see, it varies from uh Two thousand and thirteen to two thousand and twenty-four. And uh the current budget is approximately uh uh
Speaker 8: to $250,000 uh each year, but we would like to increase that, so please uh uh help us uh for that um And uh you can uh think about uh this is cool, they get monies, but how do they expend it? Sure, I we can I can tell you. So this budget uh is used for wages, especially uh for the Django fellows. And uh we have also uh the assistant treasure I was talking before. It's for also conferences and uh sponsoring events like DjangoCon or PyCon. It can be a small event or a big one. you can ask for a grant on the website.
Speaker 8: And the rest is dedicated to maintaining the infrastructure, for example, Django domains, anything like that. So I've talked about the governance, always it now, but how about the future? So what if if we add like more fonts? So this I ID uh I give uh this is not like a DSF position But just to make you realize that if we would like to have those ideas happen, we need more money, that's the current project. IDs I mentioned is things like hire a new fellow, have an executive director, or use tools that have
Speaker 8: testing, for example, accessibility testing. or increased expertise. We could have uh code of conduct trainings, things like that. And the list can be really long I would like to mention also if you are interested to this topic that there is a talk about uh How uh if we had one uh million of dollars, what could we do with uh four of the budget and uh From Jacob, the our trailer. And this is a really interesting talk. I suggest you to watch it. Unfortunately, it's in English. I'm sorry for my friend or my Japanese friend.
Speaker 8: But yeah, it's it's really something that uh if you would like to know more and uh how we could improve that, this is uh definitely something you should watch. And uh if we talked about what we currently is in progress, uh we increase fundraising, as I was mentioned, too. get these ideas done. Um we increase the DSF uh members and the representation of the community in the world. There is also working groups that have been recently approved, so the online community working groups, which is under in the tool that we have currently, like for example the Django Forum or Discord. And we have the website working group that have been recently approved.
Speaker 8: So it's really about uh jungleproject. com, how we can uh improve that and uh also maintenance. And we have working groups also in discussion between people, so the diversity and inclusion working group and the mentorship working group. If you are interested in any of those or if you have ideas, please talk to me. I will be really happy to help you know more about that. And uh last but not least, we need people. As I was mentioned, to improve the representation of TSF, more members from everywhere. and a better representation like for example in the board of director
Speaker 8: or the technical board. I don't know so many people so many Asian people in uh the board of director or the technical board. And I would like to see that. We have a lack of diversity, especially in Asia and South Africa, in uh in Django. And I know there is some people. So if you are interested, please think about that. If you want to join or create a working group, you have an ID, you should definitely be involved. There is a repo with all the working groups and if you would like to create IDs and submit an issue. to know if it's something that could interest people or people who would like to join your ID.
Speaker 8: You can definitely do that in GitHub Django slash DSF dash working dash groups. And there was a recent discussion about the change of the organization to have a better representation of the community. So if you have an opinion on an ID or you should join the conversation in DSF working groups and uh or even if you have an idea that is not like something like regional concept because it was mentioned in the DSF uh working group issue. You can definitely create a discussion in Django Forum and start to Start something like that and people can join the conversation and
Speaker 8: create something at the end You can also handle an event related to Django. You could create a local event. It can be a local meetup , Django Girls event. uh can be a small event that you even create. There is for example Django Day Copenhagen. Could be something in Asia or Chapa. There is um small small to medium uh event like for example Django con DjangoCon is a registered name so you need to apply uh to to create uh Django con it's usually uh a big conference uh which mean many countries or a region or
Speaker 8: even a continent. And this is through the form uh which is on the website under foundation slash conferences. And if you think that uh you don't know how to do that or you don't have the funds to do that We offer grants for events related to Django, depend on the size of the events. There is a form on the website you can fill if you have like enough uh ideas of uh your your event you can definitely uh give a budget for that and finally uh we need more active members in the community more reviewers, leaders, contributors, moderators, helpers and so much more.
Speaker 8: And I know that many of you like already contribute on their own. But I think it will be definitely better if we have more active people in the community. And you can definitely be involved. Don't be afraid uh even if you're starting your journey you can do patches uh if you if it's about uh code contributor you can join an event be a volunteer to organization uh in uh event or meetups and uh you can even create one and start a discussion on the forum to say you would like to create here in a specific city and have people who would like to help you So the Django uh cannot the Django
Speaker 8: is meant to be uh with the community. The Django is nothing without the community. So if you are ready to contribute, you can uh donate uh to Django. Uh the it can be through the website or through GitHub sponsors You can also ask your company to donate or become a corporate member. You can contribute to code. I put the link of a friend, which is Tim Schilling. which has done a really nice blog post if you like to start to contribute. There is a lot of great resources, including uh the Doc of Django of course. If you would like to contribute to the governance, uh you should definitely check out the DSF working groups.
Speaker 8: Oh, you can suggest one as I said. And if you would like to contact us, the board of director, if you have any question. Please do. We try your best to answer any question. So reach out to us through the phone. And that's it for me. Uh thank you as you say in Japanese. Haligato
Speaker 1: in Israel. Thank you. Thank you for making a presentation. Thank you so much. So um there's uh some questions so I'll ask uh the first thing is from Aprove Grog. Uh he said uh I really like the membership working group But can you please address what are the responsibilities of this group?
Speaker 8: Sure. Um for example if we take uh a working group, uh I think by an example it will make more sense. Um for the social uh working group, the social media one uh they they have to uh create uh hosts uh to to make uh the Django community more available to everyone and uh make aware of uh the use of Django uh it and the ideas come from the team And uh and the way to they just need to report at the end um to the board through the board of lions board of lion zone.
Speaker 8: Uh so the thing is uh you can do like everything with uh the the the working groups uh it's just like if you have an idea and you can just define it uh how how should how you should what what you should do I'm not fully awake What you should do uh and what would be the purpose of the working group to help the mission of Django, uh, which means promote uh advance the state of the of the code And uh and yes, that's that's it mostly. I hope that answers the question.
Speaker 1: Thank you. Um so the next question is car from the peacock. Are accounting uh accounting reports from the DSA is publicly avail available uh because I was accounting manager at PyCon JP 2024.
Speaker 8: Good question. I'm not sure it's a case, but I have to check. I know that uh we would like to to do more annual reports and uh Uh I'm not fully sure of the answer. I have I really have to check, but I think it's not the case right now, but it can be.
Speaker 1: Okay, thank you. Um so the next question is uh from the Titsoko Koyama. The question is uh Is there a way to get Django t-shirts from Japan? Yeah, I won't want it to do.
Speaker 8: Ooh. There is a shop in the website, juggoproject. com It should be in the footer. There is merchandise store if I remember the link. And I believe it's selling in Japan. I hope so. But I think it is. And you should you can just order there and uh the the the phone will be with us, which is cool, and you will get a t-shirt.
Speaker 1: Awesome, thank you. So I I want some uh twentieth anniversary t-shirt of Django in this year.
Speaker 8: Yeah, we we definitely thinking about that, but I think we need to find the design and uh we need people to think about the design of the anniversary t-shirt. So if there is any people thinking about that, please reach out to me.
Speaker 1: Yeah, definitely. Thank you so much. Um is there any other questions? Uh we have uh 15 minutes. We have two uh uh 15 minutes remained Il y a beaucoup de caractéristiques So the last question is come uh from me, uh Sarah. So I You uh how how many people are try are trying to uh encourage uh the the advertising the Django or like a DSF
Speaker 1: like uh uh on this event so Sarah uh helped us so uh so deeply or hardly so we it was so helpful so how many people are there uh to help So that regional Django communities
Speaker 8: Not so much.
Speaker 6: Not so much.
Speaker 8: Uh there is uh there is a people uh who are uh part of uh of the board for sure who are trying uh to to share uh what they see. Uh there is uh the people who do it the blog post um in the Django blog And all the posts which is done uh by the social media team. But we don't have like so many content uh in the blog uh currently uh which I would like we have more so if uh uh anyone would like uh to uh contribute to the content uh I'm planning to open a content team soon. So if you would like to contribute, this is a
Speaker 8: nice way uh to do that. Um but yeah, I think uh there is uh people who advertise on their own uh on the on social media, like for example on uh Twitter, Mastodon, and stuff like that. But the thing is uh it's always uh on uh your your own to to share that and sometimes it's not always the case. We have like people who retweet uh the post from Django and uh but I think it will be we will reach more people if it's be more the case. uh and there is still uh advertisement uh in some events for example in uh euro python there was uh a boot uh of dsf so we were advertising about
Speaker 8: uh uh Django and uh this is also a way to advertise it and fruit fruit talks for sure but I think it's We could do more and uh but we need people food to do that.
Speaker 1: Thank you. Thank you so much. Yeah we uh we uh we host the DjangoCongress JP too but uh yeah it seemed that uh advertising or like uh vlogging a post is a little bit hard work so sometimes it's difficult for us too. So that please help us. So everybody please yes.
Speaker 8: The thing is like we are all volunteers, so we're trying to do that when you we have sometimes and uh sometimes it's just like the not the best time for for us. I think it's uh trying the the best uh uh of what we can do, but the more people we are, it would be more easy to just to to do that and uh not have everything relying on a few people.
Speaker 1: So um can we contribute uh like uh advertising or like content creating. Uh the first is is the first step is uh becoming uh individual DSF member or like is there other approach to contribute?
Speaker 8: Uh you you can definitely contribute without being a DSF member. Um And for example, uh DSF working groups does you don't need to be uh DSF members to to be part of them. So you can definitely create uh uh I don't know for example a marketing uh DSF working group and um uh uh find a way to to give solution to uh to advertise more with uh people who are not uh especially uh uh fully aware of uh how to advertise but uh still a way to uh contribute and advertise it and the more people we have like for
Speaker 8: for example this group Twee being more IDs to to to find to to contribute and advertise it more uh on the website and uh I will be delighted to have uh this uh ID of uh advertising.
Speaker 1: Yeah thank you Yeah, that would be cool. So um if there isn't no any questions So we will we we're gonna close this session. Is it okay?
Speaker 8: Yeah, yeah, sure.
Speaker 1: Okay
Speaker 8: Just uh saying that if there are uh like any question later, you can uh reach out to me on uh my email which is here and uh also uh uh feel free to reach out on social media. I'm really happy to be there and uh thank you so much.
Speaker 1: Yeah. Thank you so much. Arigato. Arigato thank you for your making presentation and also supporting our event. Thank you so much.
Speaker 1: Hi Minasan Aigato Ghusay Mastab Kyo IT Django Congress JP Nisan Nishu, Tadosin Dita Key Master Shooka. How you enjoyed this stream, this live stream. I personally enjoy it so much uh while streaming. Mata ano konkino toga
Speaker 1: inokonimas no daomi doho kiteta kebato omoimas. So this stream will be archived on the YouTube so you can uh check it uh later like room two or like room two or room one too So that's gonna get this. Kotserani Kutina QR colo, kara Google Family Access D Kimas no de Konka eventu. So there is a survey of this event. So
Speaker 1: please submit your feedback or like your like question or like uh cheering and so on. So please uh we do your feedback through the Savi Mata to eva ad no jangono evento, the ho sit to commento itataita to kini e o line no meetup eventu datari online meetup okikak ste medionasta.
Speaker 1: This is the skinmo jangono ni hong community in se comentato are bad zehi o kakita de kibato o moimas. What did you Hi, so Django Django Janny Kozaimas ato jango. com fast. comkara kongono eventu masankadikimas and Katoi Badeskedomo foramia formitant ,
Speaker 1: konano aria. So Saiking wa so no jango ni task this jango task so no serious no hanashino dep no hanas titani. Hi, Saiyagon Dari Masaga. Announce the event on Titta degree Taminasa. So stay a support to state itaminasa. Thank you very much to all speakers that you all have to announce this event to all
Speaker 1: for support us. Uh especially that in this year the Django Software Foundation supported us so many times. Atto, eto what I start stuck, so Kyle society could say let me introduce our stuff at all Ruman, studying high senior state , what a skill harato, support to state data, and pico san. Omata san, omatasanto, kanosande, eehsin, stevasta, de eto, ima favorito view in nominasan, eto, ayako santo, harada santo, eh. Event public viewing a kaizo
Speaker 1: state demus, at all the visa , and Design this is a very good thing to study. Because I called that to Mother. But the hi -konato, public being kaizo, the high sino stakimo, maini must know the mazhi, negirati, tada kiirato, omoimas. Hi, Artamatin Narimaska, Arigato Zay Mashta, Nagai, Jikandestaketomo. Matazihi, arkai vutode, e otanoshimi
Speaker 1: kudasai. Ah no, Ine toha, mo onega ishima.
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.