# Rewriting Django from almost scratch in 2021 | Emma Delescolle

Source: https://djangotv.com/videos/djangocon-europe/2021/djangocon-2021-rewriting-django-from-almost-scratch-in-2021-emma-delescolle/
Date: 2021-07-31
Speakers: Emma Delescolle, Speaker 2, Speaker 3, Speaker 4, Speaker 5

## Summary

Emma Delescolle argues that Django’s original design reflects a 15-year-old web and could be reconsidered using today’s broader, more collaborative Python ecosystem. She walks through libraries that can provide Django-like project templates, ORM functionality, templates, settings, routing, serialization, request/response handling, command-line tools, sessions, static files, WebSockets, and API-driven forms, while noting that CSRF, authentication, authorization, the admin, and the framework’s integration glue are still missing. She describes Cordy, her experimental framework assembled from these components, and weighs its smaller codebase and shared maintenance against dependency risks, backward-compatibility concerns, and the difficulty of preserving Django’s cohesion.

## Transcript

### [00:06] Rethinking Django

**Emma Delescolle:** [00:06] And hello, everybody, and welcome to this talk. So before we get started, first of all, who am I? My name is Emma. I am the co-founder of a small Belgian company called Levik. I have had the honor to be chosen to be a DSF individual member. And I'm also the maintainer of two projects, DRF Schema Adapter and Amber C Likeities. And I guess after this talk I might be also the maintainer of CORDI. So rewriting Django from scratch, huh? Why wouldn't one want to do that? Or as someone asked me yesterday, is that even serious?

[00:54] So well yes, it is it is serious and Why would they want to do that? Django is a project that's 15 years old. So at the time of its creation, some decisions were made. And those decisions were made in regards to what was expected of a web framework at the time and more specifically for a expected of a web framework for a newspaper Those decisions were also made in regards to the resources available at the time and the climate in which these resources existed in. What is being done with Django today is far from what was initially foreseen by the creators

[01:41] Back then, a web framework, a website, or even a web application was centered mostly around request response cycles even if we still use those today and the talks of yesterday afternoon showed us that people want to keep using teas extensively. But the web has shifted to rely a lot more on APIs and WebSockets, which was really not a thing 15 years ago. APIs did exist, but they were not used to the extent that they are today And from my experience, and everyone may have a different experience, the Python world was also a lot less friendly back then. Pull requests were often ignored, package maintainers were often vooed by default, and documentation was lacking

[02:33] a lot of the time. All this to say that it made a lot of sense to write everything in-house for Django. And if you look at it, Django has surprisingly very few dependencies. With all that in mind, I had to wonder, but what if Django was being written today and leveraged the ecosystem, which is now available to us? Times have changed. Well, first of all, there's the obvious. If this was a talk I was giving 15 years ago, you would be all in front of me, live in the flesh, cheering for me Okay, maybe you would not be cheering, but at least you would

[03:19] you would be politely applauding in front of me at the end of the talk. While now we've been stuck here at home for over a year now. Some people got bored, some people's life changed. We adopted three cats. And now you are still going to be uploading, but you will probably be pasting some blob clap emojis in the chat instead of having actual clapping noise actually putting your hands together to clap And but the Python world has also changed for the better. And this is in part

[04:05] thanks to the Django community and its values. So if we look at what is different, I would say that first of all package documentation seems to be much better as a whole. The community, the whole Python community, not just the Django community, is friendlier, including package maintainers, big names. You've probably been able to see or interact with some package maintainers some former core developers of Django and things like that which is not something that you would have been doing 15 years ago, especially not interacting with Django maintainers since Django

[04:52] was just being written. But As there was also a lot less in terms of web framework at the time, John Kogo had to sometimes rely on using Rails as a reference. If you scroll through the early commits and bug reports, you can see that Frails is being mentioned a few times But no, Django itself is used as a reference and it has inspired a lot of people, it has inspired some libraries, and it has also become a model of community spirits. So these considerations were enough to start me on a journey, an experiment if you want.

### [05:41] Modern Python Building Blocks

**Emma Delescolle:** [05:41] to write a framework in the spirit of Django, but using the libraries that are available today. Now I would like to take you on a tour of the highlights of that journey. So let's start with the libraries. The ones I discovered and the one I rediscovered along the way. So for most of these, I will be showing some code examples. And I will not go through the code examples, but feel free to look at them. And they will be showing how things are done right now in Django and how things could be done using the library that I'm featuring. So let's start by the beginning, getting your Django project started.

### [06:27] Project Setup and the ORM

**Emma Delescolle:** [06:27] With Django, we do that by populating a customizable project template. But Cookie Cutter is the brainchild of a renowned Django contributor and book author, and it does just that. It lets you start project from a template, not just a Django project, any project. Interestingly enough Some other web frameworks use cookie cutter. If you have ever tried Pyramid, for example, Pyramid provides in the documentation several cookie cutters to start a Pyramid web project. The next step after starting a project is usually to define your models. Django Zorm is very friendly for you.

[07:13] And as far as I'm concerned, it's much nicer than to use than the mainstream Python RM, which is SQL IQ. And I think I'm not the only one to think that because I've heard quite a few times at Django cons or other conferences people asking if it was possible to use Django's RRM outside of Django. And apparently there are enough people who ask that question because some other people, or should I say, Django contributors Seem to think that it was a good idea to create an ORM inspired by Django, very similar to Django's RAM, and to publish it and make it available as an independent library.

[08:03] Up until last year I had never heard about P, but I'm really glad that I found out about it because using PWE is bringing the friendliness the friendliness of Django's RM to the whole Python ecosystem and you can integrate What looks a lot like Python's ORM into any of your Python projects. If you see the code examples, this is very, very similar to what you would write in Django. And the said most of the syntax for querying and things like that is also similar to Django.

### [08:50] Templates, Settings, and Routing

**Emma Delescolle:** [08:50] No, once you have written your models, you have you enter a bit of data using the admin usually. And the next step is to write a view to display that data in a friendly way. And when you write a view, you write a template. And here again we have a library that was written by a Django contributor. And which some of you might be familiar with. It's called Jinja. Jinja is a templating framework. It is very similar in syntax to Django's own templating language. And it is also compatible with Django since version 1. 8, I think. But JinJi is also available as a standalone library and can be used in other projects

[09:40] But once you get a bit deeper into your project, you usually have to make changes to Django's default settings. I think things like third-party apps, middlewares, some configuration values and so on. Django's configuration system is once again one of the nicest ones around. nicest ones around. It is easy to use compared to other solutions and sometimes you wish that this was available for the Brighton project Well, it can be. Django inspired another library, simple settings, which works exactly like Django's Conf settings modules.

[10:28] Another file that you find yourself editing quite quickly in any Django project is your URLs. py file. As far as I know, Django was one of the first Python projects to adopt a router in the style of Rails or Laravelle. I'm not sure if it was an original idea or if it was inspired by those languages and framework. But what I know is that for Django 2. 0, the routing system got a serious lifting. to accommodate for frontier or URL patterns. And no, this means that you don't need to know about regular expressions to be writing a URL in Django. Once again, this is very similar to Rails and Laravelle.

### [11:16] APIs and Command-Line Tools

**Emma Delescolle:** [11:16] But it turns out that there is another library that does that very well. And it is simply called Frouds. And it is a built it is built as a re-implementation of rails routes systems, but in Python. But all of those are quite classic in term of what they do. I said at the beginning that's of the talk that in today's web a framework had to give an important place to APIs. And who says APIs says serializers Marshmallow is a popular serialization tool and as such it has a lot of extensions to make it compatible with other libraries like Peewee, for example.

[12:05] It also has some extensions that add features like autodocumentation of the API endpoints by taking information from the serializers. It can also be used to parse some data from different locations like the JSON body, from data, URL parameters, and so on. I've not followed the project closely, but for the ones who are interested, I know that some people put together a marshmallow extension to work with Django and Django Rust framework Once again, the syntax used by marshmallowlow , once you get past the fact of calling everything schemas , the syntax of marshmallow

[12:52] is very similar to the one of Django Rest framework. But back to the basics. Even REST APIs rely on the request response cycle. So is there a Python library to help make that easier? Of course there is one. WebOp is a quite little library that traps whiskey requests and responses into more friendly Python objects. Once again, they are very similar to Django's old request and response objects, not only in purpose, but also in syntax. Now here we come to one of my favorites, Click.

[13:37] Click is a common line parser library, which is often overlooked It comes after the one used by Django, which is Arcbars, that I can never pronounce correctly. So just for that reason, I would wish to be using click instead. Although I guess that to say true to Django, you should keep using ArcBors, but I find click friendlier and more flexible as well. It's its syntax is different from the one used by Django's Management Commons. It uses mostly decorators as you can see in the in the code samples. And

### [14:23] Middleware Architecture

**Emma Delescolle:** [14:23] with those decorators you can specify options, arguments, or other information like help text and things like that. Thank you, Daniel, for liking click. And like Django, it is highly configurable, but comes with sensible defaults out of the box. No, at this point I have to make a small parenthesis. I am not the first one who thought about rewriting Django from scratch This is actually somewhat close to what is being done right now in order to better integrate WebSockets and async coding with Django. And I've talked about that with several people and during those talks

[15:08] there is a subject that came that came back and back and back It's the subject of middlewares. Why use Django middlewares when there is already a concept called whiskey middlewares And why rewrite a lot of things as Dango middle words when they already exist as whiskey middle words? So What is a whiskey middleware? It turns out that whiskey middleware is nothing else than a fancy wrapper. With a set interface. A whiskey middleware receives the environment. So basically the whiskey request and a handler.

[15:53] A handler is your application, it's it's Django itself. And when executed, it has the opportunity to make changes to the environment, to the request, before it is passed to the application. And you can also make changes to the results, like the rendered web page, once the application has run. it is still your responsibility, still the application's responsibility to call the middleware. The application has to there needs to be code to call the middleware. It's not magically called by whiskey. It's just a convention to have functions that can act that way and that can wrap around your main application.

[16:42] The main applications role. The role of Django is in a I'm going to simplify this, but the role of Django is to match the URL in the environment in the request to a view and to call the view with whatever parameters it was able to get from the from the request URL and as well as the rest of the things in the request itself like the body and so on But it is still the job of the application to wrap that handler, that handler of a request into the Whiskey middlewares. But

[17:27] before we go any further into middlewares and seeing how Django handles things, I do want to mention two very useful middlewares. One is speaker. It is used to handle everything that is related to sessions. And it is indeed a very nice library that already exists. And there's also static, which you might have guessed from the name. It helps you handle static files. And I should have put my tablet, do not disturb. Static handles static files, probably mostly during development, since in production you want your Nginx or Apache server to do that for you.

[18:16] So Django middlewares are just and I am thinking just a fancy whiskey middleware wrapper. As whisky middle words they receive the handler so the application itself the rest of Django And it receives that with the request, it receives that at initialization time and at risk request time at execution time it receives the risky request Or in the case of Django, it receives the request object. Where it gets really interesting is that The middlewares, Django's middlewares also provide other hooks to be able to interact with the request and response objects.

### [19:04] Async Support and WebSockets

**Emma Delescolle:** [19:04] Like right before the template is rendered, you have your response object You have the context, you have, but the re the response is not rendered yet. So you can inject things in your context and things like that. It allows for much more flexibility than whiskey with middlewares. And they're still compatible with whisky middleware since their interface is quite similar. So you can easily wrap an existing whisky middleware into a Django middleware. So the next other big thing that Django was not originally planned for is WebSockets. Web sockets or permanent connections

[19:50] that work asynchronously most of the time. And depending on what they're meant to do, they can be linked to a pop sub system like Redis. Unfortunately, sync and async codes don't mix well in Python This is why a lot of effort is being put into Django to make it play nice with async native applications. and async native code. And for that we have a new standard which is ASCII and we have servers like UVCorn and Daphne. But those are still very young. Now if you're going to couple your web framework with a starsky

[20:36] application server I would rather couple it with one that is being tried and proven. And it just so happens that U Whiskey, one of the best established whiskey servers , Provides some proprietary, and when I say proprietary, I mean something that is not part of the WISCI specification. It provides handling of web sockets in a synchronous way. So If I was going to tie my framework to a specific Storsky implementation or Storsky provider, I would probably think that QWISKY is not a bad choice. But back to regular features now.

### [21:21] Forms, Administration, and Missing Pieces

**Emma Delescolle:** [21:21] One of the things Django is famous for is its admin and its ability to generate forms from model with very little code. So that too can be done with other libraries that exist out there. But since we are focusing on APIs, why not go all the way? VJSF, VIDI JSON Schema Form, is a view component that can run directly out of a CDN and provides form for REST API as long as the API can provide a data structure in the form of JSON schema. As I mentioned earlier, Marshmallow comes with many extensions. And one of them is Marshmallow JSON schema, which provides JSON schema information for marshmallow

[22:08] series. And in the way of doing JavaScript without writing any JavaScript, you can use your API, your existing API dump the JSON of the that comes out of that API into a document and also load those libraries directly from CDM not write any code and have a form being rendered. So Is that it? No, we put everything in the blender, we turn it on, we pour it in a jar, and we have some new Django. Well, not exactly. It could not be that easy.

[22:54] There are some missing links. And there are things that are not provided by libraries, or at least there are things that I could not find. That were reliable enough and could be plugged into something else and existed like that in the ecosystem The missing links I found were those. I could not find any library that provided C cure CSRS in a framework agnostic environment. Authentication and authorization also seem to be the sort of things that you can't find in the library format. And but there is a there is a whiskey middleware that provides some authentication methods, but nothing close to what you would expect from a framework like Django.

[23:45] The admin. It's a subject that has been carefully avoided so far. And well basically there is no such library. The admin is unique to Django so far. And finally, putting everything in a blender is not going to be enough to get everything to stick together. We are going to need some glue code So are there solutions for that? Well, as far as CSRF and authentication are concerned, we can simply reuse the existing codes from Django. Remember the title. This is a rewrite almost from scratch. The admin, no, I know this is a touchy subject, but While being one of the most appreciated features of Django, the admin is also the least understood and the least trusted.

### [24:36] Cordy: The Glue Code

**Emma Delescolle:** [24:36] Remember, never expose the admin to end users, we cannot guarantee anything. So I vote for getting it rid of it altogether and replace it by something that leverages the rest of the framework, something like Django admin 2 that uses regular forms and views to provide an admin-like interface. Finally, the glue code. Well The glue code is what I've been doing while I was bored during the pandemic. And it is called Cordy. And it even has a mascot that's to tell you how deep into the rabbit hole I went. So first of all, the name Cordy.

[25:22] It's an homage to Annie Cordy who 's a Belgian singer and actress who died in 2020. It's infitting, given that Tango is named after a guitarist. There's also a pun in there of course because cordy chord, like guitar chord, yep, sorry the mascot is simply a chord or rope that acts in a Python as well. And I find it cute. So Cordy, Cordy is the code I wrote to vope in, sorry, this is the last one, I promise, to vopin together all the libraries I mentioned before.

[26:09] It is not much code, all in all but it's about it's less than four thousand lines of code. Excluding documentation and tests because I didn't write any documentation and test. But it deals with most of what I mentioned before and also a few extra things like migrations, for example. It all started as a thought experiment. I'm glad I did it and hopefully that journey taught me more about Chang. And I hope it is useful to you others as well. It seems very timely since the technical committee for Django 4 is being put together right now as far as I know. And maybe someone will think that

### [26:55] Cordy in Practice

**Emma Delescolle:** [26:55] my weird ideas are not so weird after all and that they might try to put them in practice into Django 4 So we'll show you a few good examples of working code for Courtdy In my opinion, it is very close to what you would write in the current version of Django. So here you have a models example. You should probably look more closely to the to-do model. Next we have controllers. As a side note, I really couldn't resist and I had to go back to the MVC terminology, model view controller. Instead of Django's MV key model

[27:41] view template. But I did keep some of the usual Django class names, or rather Django REST framework class name, like view sets. The last controller on the left makes heavy use of decorators. I'm not sure I have a an opinion on that. It's Something that you don't do a lot in Django, but it's worth it's a feature and why not use it. And on the right you see a WebSocket controller That is quite similar to another controller. Its entry point method is connect and as from here it looks rather simple. Finally

[28:27] , this is a full URL. py file. It is not exactly the same as Django's URL. py, but I don't think it's hard to read either. Notice the star unpacking syntax for the two first URLs that That are a way to use get routes, which will get all the routes directly from a controller. So controllers are what you would say are class-based views right now in Django. And the route before last, which is a WebSocket route, and it is just declared as any other route in the project. It doesn't care that

### [29:12] Tradeoffs of a Rewrite

**Emma Delescolle:** [29:12] it's a WebSocket. And with the code that I just showed you right now, you what you can do is that you can write list views and form views like you would in Django. And you don't need to write any templating, the those templates are already included in CORDI. And So all in all, it's not that different after all from the Django Admin. So in conclusion, what would be the pros and cons of rewriting Django from scratch and using those libraries I mentioned? Well, the biggest con, I guess, is the loss of agency.

[29:59] You are going to be depending on other library maintainers And I guess one solution is to fork those libraries, but that's not the friendly way to go. But That that con is also a probe because right now you have a lot of libraries that already have maintainers, people are working on it, and all those people would by extension be working for Django. And that would make maintaining everything easier too. But using those libraries, at some point there will be some loss of backward compatibility. And of course you would need to do a rewrite if we

[30:44] rewrite. But as I mentioned, CORDI so far is less than 4,000 lines of code, so it's not that big of a work Finally, I am now going to go into Jitsi for the questions. But before going there, I mean I did mention that I adopted three cats, so I had to show those cats to you. So the first one is foot. is the smallest. Shell, she's the female ones. The other two are boys. And Curry. Curry is the fluffy one. So during the Q<unk>A in Jitsi, I will also be streaming

[31:33] a demo application. It's a game based on Splendor, for the ones of you who know that. And I played it with a few people already yesterday. I will paste the link to the game in the Slack and you can all play the game it's a demo so don't exp there are some features that are obviously missing but it is a project that was written entirely with cordi and that seems to be working quite fine. Thank you for listening Hello everyone. I hope you enjoyed the talk.

### [32:16] Questions and Discussion

**Speaker 2:** [32:16] Yeah, it was very good. Thank you, Emma. It was really interesting.

**Emma Delescolle:** [32:19] Thank you. I guess you're one of the people who is going to be involved in the rewriting in writing Django 4

**Speaker 2:** [32:32] Well, I I'm certainly I, you know, I'm there sweeping the floor. I'm like the Maris and I like the janitors. I don't know about rewriting. I think, you know, Jang Django is very stable, right? So one of the big consideration one of the big considerations we have is the backwards compatibility. I my sort of My kind of one thought is it with the API stability policy, is it at all possible for us to rewrite on this kind of scale

**Emma Delescolle:** [33:06] Yeah, I don't I don't think I don't think so. You probably won't be able to rewrite on that kind of scale, but as I understood there's some rewrite that has to be done for async compatibility at least.

**Speaker 2:** [33:28] Yeah, I mean yeah the async is an opportunity to look at that core request response handling and to look at the ORM and you know, think about what we can do there.

**Emma Delescolle:** [33:42] Yeah. So I guess a lot of people got here. Does anyone have questions? I don't see any questions so far.

**Speaker 2:** [34:09] God, I'll I'll ask you a question then. Okay, so Just thinking about the dependency on other packages. So one of the one of the sort of historically nice things about Django is you pip install Django. you don't have to then go and find the form library and the middlewares and the no all the components. You don't have to go and separately find those and contrast that to the experience in the say Node. js world where you know it's nor the norm is to go and pick you know craft your hand collected your hand picked package libraries and dependencies Is that kind of a change of that would be I mean that would be a change of style or would do you envisage the that list of being curated for you.

[34:57] So you've still got pip install cordial pip install Django and you get that you get everything you need.

**Emma Delescolle:** [35:03] Oh yeah, that that list would be curated. I guess you could in envision if you want to go with the pyramid route I guess you could have different versions of that list. Like I just want Cordy, I don't want URM, I don't want templates, I don't want anything, I just want that I guess that that list could be created for you in several versions. But right now I published Gordy yesterday or the day before on pip. So you can pip install cordi cody and it will install everything, TRM, the templating engine, everything. And yeah, it when you do that, it looks more like a Node. js project where it does have a lot of dependencies

[35:50] that get installed. But yeah, I don't know. I'm not I'm not the maintainer of such a big project as Django. So As I said, I think there are pros and cons to depending on other libraries. And yeah, what is sure is that right now Django does not depend on a lot of things.

**Speaker 2:** [36:18] Yeah, no, I mean it's it's just interesting, is that that kind of that ability to find the packages. Anyway, but thank you, yeah, that's super.

**Emma Delescolle:** [36:27] You're welcome. Pablo you're raising your hand

**Speaker 3:** [36:34] yes thank you Emma for your talk was very interesting I didn't know so many different packages to do what you have done and what you showed. I want to ask you a question similar to the one that Carlon Carlton have done so the you afraid to rely on so many different packages all around the Python package index. It's something that's usually scare me and is the main reason and I prefer to contribute to the core of Django instead of

[37:19] creating different packages more than one had trouble updating and being able to up to date different packages. I don't know if someone here have ever used Plone. It's basically a very old framework and it it's The main reason I ended using Plone is because it was release on so many different packages based on Zoop and XML and at the end Yeah, I I've spent more time

[38:06] Having all functioning together than developing new part. So is the main is I think I like a lot in Django is there is so few dependencies and rely a lot on standard library. So the question was are not you scared to rely on so many different pages?

**Emma Delescolle:** [38:33] Well first of all Plone is special I'm still not sure how to install Plone correctly. I'm still not sure what is the correct way to install Plone. I'm sure it's not just piping stall. So yeah, depending on being dependent on many libraries is something that can be scary one solution I give if some library is not getting is not getting updated in time and things like that, it's still a possibility to fork that library and to have a Django or a Cordy version of that library.

[39:18] that's that's one solution. Because the biggest benefit of using libraries is that you have human time you have human hours that you will not be putting into developing into writing those libraries. So you have extra hand power to be able to do those kind of things like forking an existing library that has been trusted by the maintainer or instead of forking having a friendly takeover something like jazz band does and that's th that 's so some solutions I see to that problem.

[40:04] Given that everything is open source, I don't see that it would be a blocker. I Can see that it would be annoying, especially if you have one of those libraries that but then you have to choose your libraries. If one of those libraries is maintained by an unfriendly maintainer that doesn't merge p merge pull request or doesn't want to hear about your project that's using the library. That that's one of the main cases I can see where it can be a problem of depending on so many libraries But I've also been working in JavaScript

[40:50] and this is this is something that seems to be working for them. So Why not?

**Speaker 3:** [41:04] okay, thank you.

**Emma Delescolle:** [41:06] You're welcome I see that Johannes is also raising his hand.

**Speaker 4:** [41:14] I don't have a camera, sorry you can't see me. Let me let me start by saying great talk and great initiative, and I'm really excited to see what's coming out of this. I just want to point out one thing that I like about Django and that is I think hard to achieve in a library situation. And that's the cohesiveness of Django. In Django, every part feels like it's been designed with the same goals in mind and with the same structure in mind. So when I switch from the models to the forms, it feels very natural that these two parts go together. And that is already a problem if you go to even slightly different libraries like the Django Rest framework. It it's quite obvious that Django Rest

[42:00] framework is designed with Django in mind, but it doesn't feel exactly the same. It feels like it goes further or it goes beyond the feeling of Django. And this cohesion, this cohesiveness is one of the things that I like very much about Django because it makes it easy to switch from one part to the next. So I think this is going to be something that's very hard to maintain in a library situation.

**Emma Delescolle:** [42:25] It is indeed harder to maintain in a library situation, but If you remember the first three or four libraries that I mentioned, they are developed by either Django, Django maintainer, Django Cordie X Django core developers or they were inspired by Django. So they all have that Django feeling that comes with them now one library that I mentioned that really doesn't feel like Django is the routes library. So the library that does the routing. But it feels like Rails, and I'm still pretty sure that

[43:14] the routing in Django is trying to feel like Rails. So Yes, there are there's gonna be some differences like marshmallow. I'm still not over the fact of calling everything schemas. That's That's something I have a hard time with coming from Django. And that that doesn't have a Django feeling. But Honestly, by selecting by carefully selecting libraries, and I'm not saying that all the libraries are mentioned have been carefully selected. In for a real Django Vite, I would have looked closer at things like

[44:00] does the library have a code of conduct? Is the maintainer nice? And things like that. Which I didn't do in this case. But by selecting carefully selecting the libraries and eventually forking the ones that don't meet the criteria, I think it's possible. to achieve that cohesion, that Django feeling for whole thing.

**Speaker 4:** [44:25] Yeah, yeah, so I think I think it's possible to achieve that too. And I see this as a challenge and as an opportunity because as you say there are these impulses that come from outside or that that come from the other frameworks and that we should really think very hard about. So This is something that's both positive and negative. So yeah. All right. Thanks everyone.

**Emma Delescolle:** [44:49] Yeah, definitely there are pros and cons. Absolutely.

**Speaker 4:** [44:53] Great. Thanks.

**Emma Delescolle:** [44:54] You're welcome anyone else has question?

**Speaker 3:** [45:04] I have a question. I I'm a curiosity. You are long time Chango user and so a lot of your presentation and talk I so I think you know Django pretty well but there is something you learned in this experiment to write in Django about Django itself. I don't know, trying to search for alternative packages to replace. feature and you found out new things about Django in this process.

**Emma Delescolle:** [45:41] Yes, there are two things I found out about well that I learned about I did a deep dive into the middlewares and what were middlewares and I didn't know that Django middlewares were so close to the concept of whiskey middleware. I didn't know what the whiskey middleware actually was before doing this. So I learned a lot about this middle order, the way middle orders work. And I also learned a lot about the request response cycle and how that is being handled in Django, the order of doing things and how

[46:27] How do you handle a whiskey request that that comes in? What is a whiskey request? How do you handle that? How do you turn that into an object? And then what do you do? How does the routing and matching that request with the routes work and all that the I had never really delved that deep into the ural pattern matching so I did a bigger dive in that. And yeah those are the two main things I guess I learned about Django during this experience.

**Speaker 3:** [47:14] Thanks.

**Speaker 5:** [47:21] Hi Emma, thanks. Thanks for the very interesting talk. I was wondering, I'm curious, have you considered or have you had a look at Fast API and considered if that could be a starting point? Because you know it's it's API first, it's using Pydentic for model validation and serialization. Have you thought about that? What what's your thought?

**Emma Delescolle:** [47:50] I did look at it. I have so The main thing I have against fast API is that right now it's It has very little support for authentication, for example. And I've had some issues with the database package so I don't think it's ready. I and I think that's mainly because of the challenge of making everything a thing. And as I say, mixing sync and async doesn't work well in Python.

[48:35] And so this means that fast API can have trouble integrating with other libraries, existing libraries because of the sync nature of those libraries So fast API can do both sync and async, and so if you're writing a sync method, you can you could you could use Peewee with that, but if you're writing an async method then you cannot use PWE and you need something around that. And that that for me is an issue with Fast API right now. I know that I forgot his name now. The maintainer of Django

[49:20] Rest framework. I know that he's working a lot on the package that's called databases to make to make that abstraction easier. But right now it's it's not possible. And regarding pedantic, I like the concept, but I find it way less flexible than Django. That what Django has to offer. For example, you don't have a type, you don't have a Python type for a URL But in Django you have the concept of URL field. And you have so many more fields that are

[50:08] Easy to access field types that are easy to access that you are not getting by using strong typing only So I see the I see the need of something like marshmallow to do the to do the serialization and the validation because that's something that's lets you do things a lot more in depth that what you can do with pedantic or if you can do this with pedantic it will be a lot more work to achieve the same goal.

**Speaker 5:** [50:49] Yeah, that that's very interesting to get your view on that. Yeah. And I and I see, and I can see that, yeah, those points that you mentioned. Okay, thank you.

**Emma Delescolle:** [51:01] You're welcome. Anyone else? I think the next talk is started.

**Speaker 3:** [51:11] Yeah.

**Speaker 2:** [51:13] I don't have any more questions, Emma, but I do want to say thank you. It's a really interesting talk and interesting discussion afterwards. It's you know it's Yeah, I don't know how much we can rewrite the core of Django, but it's really nice to take the possibility and think about you know how it would look and what would how that would go and you know

**Emma Delescolle:** [51:35] yesterday someone asked me do you do you expect this to become Django four Django five? I said no. I don't expect somebody to take that code and turn it into Django. That's that's not that's not the purpose of this. But yeah I think there are some ideas that are worth thinking about.

**Speaker 2:** [51:53] Yeah super. Thank you.

**Emma Delescolle:** [51:55] You're welcome

**Speaker 3:** [51:56] It could be interesting to know which parts you found in other packages that we can reuse in Django in the core. Especially now that we are writing so new code for the async part and there is Also new packages in the Django Foundation group like Django channels and similar so can be interesting to understand which code to take inspiration from and not reusing but also being inspired to improve Django

[52:42] or also to simplify some part of Django.

**Emma Delescolle:** [52:45] Well to simplify Django I think Pee-Wee is a really interesting package to look at because Pee Wee is being done to look like and feel like Django's RM It's been done by a Django contributor and Django's RM is the one part that I've heard people asking the most if it's possible to use the orm, Django's ORM outside of Django. And next thing that I've heard people ask about is Django Forms Can you take Django forms outside of Django?

[53:31] Can you use Django forms outside of Django? And so writing Django Forms, rewriting Django Forms as a Pee Wee plugin, like there is a Marshmallow plugin for Pee Wee. I think that that could make things very interesting and that would that would help all those people who have been asking those questions about Taking the orm out of Django and using that, taking the forms out of Django and using that. I've I I've worked on another side project which is a pot a podcatcher

[54:17] To listen to podcasts and When I realized that I needed a database, the first thing I did was use Peewee. So I think that that is a really interesting library. And being able to uncouple the RM from Tango, that that would I think that would be a super nice feature. And I've also seen some talks about people trying to use SQL alchemy with Django. So Maybe seeing something modular as with the templates, with the templates engine right now and have the concept of a an ARM engine that could be pluggable into Django.

[55:03] I think that that might be a very interesting idea. I think it's a lot of work but I really think that that could be a very interesting idea

**Speaker 3:** [55:17] okay thank you very much again

**Emma Delescolle:** [55:20] you're welcome

**Speaker 3:** [55:22] Bye.

**Emma Delescolle:** [55:23] Bye.

**Speaker 2:** [55:27] Right. Thank you again, Emma. I'm gonna chop on to the next one. Thank you. Thank you. So good.

**Emma Delescolle:** [55:31] Thank you. Bye.

**Speaker 2:** [55:33] Take care. Have a good day. See you around.

**Emma Delescolle:** [55:35] Have a nice day.
