DjangoCon Europe 2019 - Lightning Talks Day 2
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 32 | |
Author | ||
License | CC Attribution 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/45434 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
00:00
Wireless LANLoop (music)WordPasswordIntegrated development environmentLocal ringDifferent (Kate Ryan album)CodeFlow separationVariable (mathematics)DatabaseLogicFrequencySensitivity analysisShared memoryPoint (geometry)Regular graphSet (mathematics)1 (number)XMLComputer animation
00:28
Default (computer science)PasswordDatabaseLocal ringCodeLogicSoftware developerIntegrated development environmentLocal ringSet (mathematics)Latent heatPiFlow separationExtension (kinesiology)Computer fileSensitivity analysisComputer animation
00:58
DatabaseData structureComputer fileLocal ringDefault (computer science)Integrated development environmentFlow separationServer (computing)Token ringPasswordInheritance (object-oriented programming)Software developerIntegrated development environmentExtension (kinesiology)Set (mathematics)Computer fileRevision controlInheritance (object-oriented programming)Different (Kate Ryan album)Control systemSoftware developerComputer animation
01:31
Variable (mathematics)Integrated development environmentException handlingData conversionDatabaseDefault (computer science)Variable (mathematics)Integrated development environmentType theorySlide ruleCartesian coordinate systemWrapper (data mining)Default (computer science)QuicksortError messageComputer animation
02:07
Variable (mathematics)Integrated development environmentDefault (computer science)Software developerCodeParity (mathematics)Inheritance (object-oriented programming)Configuration spaceConcurrency (computer science)Keyboard shortcutBlogService (economics)Process (computing)FaktorenanalyseVariable (mathematics)Configuration spaceDivisorServer (computing)Inheritance (object-oriented programming)Parity (mathematics)CodeIntegrated development environmentComputer architectureType theoryBuildingReduction of orderTerm (mathematics)Scaling (geometry)Metropolitan area networkUltraviolet photoelectron spectroscopyInternet service providerWebsiteArmWeb 2.0Point cloudWeb applicationComputer animation
03:05
Cache (computing)FingerprintTemplate (C++)Uniform resource locatorReal numberIndependent set (graph theory)Execution unitSynchronizationType theoryDefault (computer science)Set (mathematics)CodeComputer animation
03:34
Data structureRaw image formatLocal GroupModule (mathematics)Mobile appSoftware frameworkEmailData structureIntegrated development environmentGroup actionProjective planeCASE <Informatik>Heegaard splittingSet (mathematics)Computer fileDifferential (mechanical device)Order (biology)Computer animation
04:00
WritingDefault (computer science)Descriptive statisticsVariable (mathematics)MereologyProjective planeWater vaporSet (mathematics)Rule of inferenceWritingSoftware developerComputer animation
04:26
Variable (mathematics)Integrated development environmentConfiguration spaceKey (cryptography)WritingDefault (computer science)Group actionToken ringTypprüfungHeegaard splittingSet (mathematics)NP-hardGroup actionVideo gameType theoryWave packetBitProjective planeSlide ruleLink (knot theory)QuicksortData conversionEndliche ModelltheorieBlogMultiplication signRule of inferenceMessage passingPattern languageLevel (video gaming)Process (computing)Hand fanComputer animationXMLUML
06:55
CodeType theoryFunctional (mathematics)Projective planeQuicksortParameter (computer programming)Social classComputer fileInterface (computing)String (computer science)PiCASE <Informatik>Online helpComputer animation
07:59
Attribute grammarType theoryComputer configurationPiProjective planeRevision controlError messageSet (mathematics)Endliche ModelltheorieObject (grammar)Computer filePlug-in (computing)
08:55
Field (computer science)Endliche ModelltheorieRow (database)Theory of relativityString (computer science)Type theoryFunctional (mathematics)PiResultantCASE <Informatik>Set (mathematics)Cartesian coordinate systemElectronic mailing listKey (cryptography)IntegerQuery languageExistenceSource code
10:29
Software testingProjective planeRevision controlSet (mathematics)Software frameworkComputer filePlug-in (computing)Theory of relativityConfiguration space
11:17
Information privacyDefault (computer science)Mobile appVideo gameType theorySoftware testingProjective planeShared memoryPosition operatorUniformer RaumExtension (kinesiology)CASE <Informatik>Information systemsEqualiser (mathematics)XMLUMLComputer animation
12:31
ImplementationInformation privacyDefault (computer science)Mobile appPhysical systemCASE <Informatik>Information systemsShared memorySource codeTwitterIncidence algebraGoogolCodeImplementationLine (geometry)Moment (mathematics)Information privacyLoginDefault (computer science)Mobile appLevel (video gaming)NumberDistanceComputer animationMeeting/Interview
13:22
EmailInformationString (computer science)Wrapper (data mining)Variable (mathematics)Data typeEmailString (computer science)PseudonymizationInstance (computer science)Object (grammar)Computer animation
14:00
String (computer science)Wrapper (data mining)Data typeInstance (computer science)Object (grammar)Context awarenessExterior algebraComputer animation
14:33
String (computer science)Wrapper (data mining)Field (computer science)DatabaseDatabaseType theoryTable (information)Instance (computer science)Field (computer science)RepetitionMixed realityEndliche ModelltheorieComputer animationProgram flowchart
15:09
Field (computer science)Data modelSystem callField (computer science)Context awarenessRevision controlMultiplication signData managementLoginComputer animation
15:35
Level (video gaming)Form (programming)EmailBlogMessage passingComputer fileLoginComputer animation
16:07
EmailInformationTemplate (C++)Digital filterCAN busOpen sourceFilter <Stochastik>Template (C++)Instance (computer science)Computer animation
16:46
Template (C++)Resampling (statistics)Condition numberForm (programming)CASE <Informatik>Multiplication signComputer animation
17:11
Hardy spacePhysical lawRing (mathematics)Video gameMathematicsSelf-organizationComputer programmingPhysical lawState of matterBitForcing (mathematics)Local ringGoodness of fitSubgroupFood energyRandomizationPoint (geometry)Social classData conversionLattice (order)Open sourceTrailWebsiteKey (cryptography)Different (Kate Ryan album)NeuroinformatikComputing platformHTTP cookieMultiplication signMessage passingBookmark (World Wide Web)Projective planeGraph coloringComputer animation
23:37
Exception handlingSocial classNeuroinformatikLecture/ConferenceMeeting/Interview
24:05
VideoconferencingUniverse (mathematics)Process (computing)Control flowRepresentation (politics)NeuroinformatikComputer animationMeeting/Interview
24:40
Wave packetVideoconferencingTerm (mathematics)NeuroinformatikCollaborationismYouTubeComputer animation
25:29
Extension (kinesiology)NeuroinformatikBitGroup actionInheritance (object-oriented programming)Special unitary groupWordLattice (order)Self-organizationOnline helpSoftware developerComputer animation
27:49
Dean numberVideo gameProjective planeLocal ringLink (knot theory)PlanningPoint (geometry)Different (Kate Ryan album)FreewarePhysical law1 (number)XMLComputer animation
29:40
Translation (relic)ConsistencyLibrary (computing)State of matterForcing (mathematics)LeakPoint (geometry)Data storage deviceCartesian coordinate systemSoftware frameworkInternationalization and localizationTrailOffice suiteTwitterSoftware developerFormal languageLocal ringInstance (computer science)Thread (computing)Disk read-and-write headComputer animation
30:59
Data storage deviceTranslation (relic)ConsistencyLocal ringCodeLibrary (computing)Point (geometry)Cycle (graph theory)State of matterComputer fileMiddlewareComputer animation
31:34
Dependent and independent variablesPoint (geometry)Cartesian coordinate systemKeyboard shortcutObject (grammar)Uniform resource locatorCodeLibrary (computing)Computer animation
32:22
CodeLibrary (computing)Endliche ModelltheorieVariable (mathematics)Programmer (hardware)State of matterBitMessage passingLevel (video gaming)Moment (mathematics)Dependent and independent variablesNormal (geometry)Computer animation
Transcript: English(auto-generated)
00:02
It's handling sensitive data like database, passwords, tokens to third-party APIs, et cetera. It's also sharing settings between your team members. And as we all know, Django settings is a regular Python code, so it could have some tricky and obvious logic.
00:20
There are different approaches to solve this issue. So let's briefly talk about the most popular ones. So settings local approach, it's maybe the most simplest and the most older thing. So you split your settings to base settings
00:41
and settings.py and environment specific settings to settings local.py. This approach partly solves issue with sensitive data, but still it has a lot of disadvantages. So the next approach is separate settings file
01:01
for each environment. With this approach, you separate your settings by environments till you have this base file. So it's like an extension of previous method. And it's solved this issue with different environments there in version control system,
01:22
and it's easy to share settings between developers, but still you need somehow handle secret data and still you have this inheritance. The next approach is environment variables, and this is just some basic example and has some issues.
01:40
So let's have a look on advanced example. Instead of using ous.environ directly, it's better to write some wrapper and to handle K error, and also you can add their default values and type conversion, but it's better to use a third party application.
02:04
We will talk about it later in several slides. So this approach has a lot of advantages. Finally, we have configuration separate from code. You have environment parity between all your servers. There is no inheritance,
02:21
and also there is a theoretical grounding for using environment variables for configuration. It's 12 factors. So 12 factors, it's a collection of recommendation to build web apps to be easily deploy and scale in cloud. It was created by Heroku,
02:41
a well-known cloud hosting provider. And in terms of this talk, we are interested in configuration factor, which literally says that we need to use environment variables for this. So if you are not familiar with 12 factor, I strongly recommend you to check their website. They have really clear explanations for each factor
03:02
and architecture, all in all. And now let's go back to the tooling, and we found that Django Environ, it's a very convenient app. It has a really nice API that handles all type conversion, default values, et cetera. So let's have a look on examples.
03:21
That's how your settings look before. That's how they look after applying Django Environ. So the code became clearer and more readable. So please check this up. Several words about structure. We recommend to split your settings,
03:41
but not by environment, but by groups. And in this case, you can differentiate Django, third party, and your custom settings. And if your project will be growing, you can implement each of this file as a package and split it more granularly.
04:03
As we all know, naming variables is the most hardest part of the development, so this works as settings too. We cannot imply on Django or third party settings, but we can follow the simple rules for our custom settings. So let's give them meaningful names,
04:22
use prefix with the project name for our custom settings, and write descriptions. So let's quickly summarize. Keep settings in environment, don't hard code, split settings into group, and follow naming conventions. This is the link to slides and other resources.
04:42
Also, please check article on our blog site. Thank you. Thank you very much, Alexander. Our next speaker is Seth. Seth, you can jump up on stage and get ready. So I arrived in Denmark for the first time on Tuesday,
05:04
and on the train coming in from the airport, I actually had a really, broke up, I started a really interesting conversation with a local who told me a piece about, a bit of history about a Spanish gentleman who came to live in Denmark named Juan, who's come down, become very, very well known in Denmark
05:20
for the impact that he's had on politics and sort of the Danish way of life. Juan was just universally loved by his neighbors. He was just a quiet guy, lived by himself, kept to himself, but was just a model for what a citizen should be. You know, came from Spain, came to live in Denmark, became a model citizen.
05:40
And everyone was sort of wondering, how does he get to be such a good citizen? Are we ready? Do we have slides? No? No, we still don't have slides yet, okay. So his next door neighbor sort of found out about Juan first and came over and had a bit of a chat with him and sort of find out what was going on
06:01
and learned this really, really valuable lesson and took it back and started to live his own life following the same rules and patterns that Juan had taught him in this really, really simple conversation that had happened. And again, sort of the message started going, all of a sudden there was two people living next door to each other that were living the best possible life
06:23
and everybody around them started to notice that here are two very, very happy people living the best model of what it is to be a Dane in the modern world. We're still going? Still waiting for slides, okay. Yes, we have slides now.
06:42
All right, so we will continue the story of Juan after Seth Yastrov talks to us about type checking your Django. Thank you. Hi, I'm gonna talk about type checking your Django project. So if you don't know, Python has type annotations
07:02
added since Python 3 and you can also put them in, you can also put type annotations in your Python 2 code with some type comments. MyPy is a type checker, you can install it and let's say you have a function
07:21
and you want to annotate the argument and return type, you can call it with the wrong type, in this case, string, although it should be an int, you get an error. So that's great. But what if you wanna type check your Django code? Well, there are stub files which define the interface
07:42
for all sorts of Django functions, classes and so on. It's a project on GitHub by Maxim Kornikov and other people have contributed as well. You can just pip install it to your project. So let's say I made a Django project
08:03
and I want to type check it with myPy. So I make a myPy ini file and add in some options and then run it and I get this error about need some type annotation, something in the settings.
08:22
Let's see, and if I add this plugin to this config, the plugin comes with the stubs, it will not complain. And this plugin does some cool magic stuff so that you can actually type check some of the cool Django features like the ORM.
08:42
So if you try to construct some object model and it doesn't have actually the attribute you're using, it will tell you about that. Let's say you have a character field on your model
09:01
and you try to pass it a none but it's not nullable, it will complain about that. Let's say you have a relation to a foreign key, to a related model and you try to access that
09:21
on another model and access a field on that, it will also be able to follow that relation and type check that field. So in this case, you can't add an integer to a string, it's name on the publisher.
09:40
And finally, a more complicated example, if you are using this values list function to get, in this case, just one value from a query as your result, in this case, the name field of this person model, then you should get a string back
10:02
but because you are only asking for the first row, you might get a none back if the row didn't exist. So actually, if you try to pass this to a function that takes a string, it will complain because it might actually be none and we had a strict optional setting enabled in mypy.
10:26
So this is very cool. There are also non-ORM stuff, these stubs. There are stubs for pretty much all of Django but it's probably not entirely correct or incomplete
10:43
because a lot of it was generated with some tools. Yes, thanks. If you have a custom settings module, you can also specify that in a config file and it will understand that and you can contribute.
11:03
At GitHub, it's actively developed and there's also a ghetto channel and there's also a related plugin and stubs if you're using Django REST framework. So where to go from here?
11:21
Yeah, the project has some tests actually on type checking the Django tests itself which they don't all pass so there's some things ignored but if more of them pass, then it kind of shows that it's pretty legit or at least pretty accurate in not giving false positives
11:41
and you guys should try it out on your projects. Thank you. Thank you, Seth, while our next speaker gets set up. So Juan has told his next door neighbor about this great secret and now we've got two people living their best lives,
12:00
their best Danish lives. They then start, the people on the rest of the street, they notice this is going on and so they come over and they say, so you know, what's the big secret here? And they, Seth and, sorry, Juan and his neighbor both share this one little short secret about how to live your best life. And yeah, so okay, we're ready.
12:22
So our next speaker is Francois Seguin. Take it away. Hey, bonjour, hi, my name is Francois Seguin. My Twitter handle is Haldy. It's not an Indian restaurant in Liverpool in case you see some mentions. I work at Polyconcet, we're in Paris, a company which among other things,
12:42
we make information systems behind electric vehicle charging and car sharing systems such as Source London and Blue LA in Los Angeles. So I switched careers actually a year ago. I've been working at Polyconcet for six months and my mission at the moment is how to implement
13:02
privacy by default in an existing Django app. So we have a million lines of code approximately, so I couldn't afford to do it by hand and manually. I'm not crazy and I'm very lazy. So also if I missed anything that could cause a very bad personal data leak.
13:21
So I'll take an example in logs. For example, what if we logged something very badly? The customer would edit their details. So we have an email address, we have a phone number, birth date, some actual details. What we wanted was something with redacted values, something that would be anonymized or pseudonymized.
13:43
So the solution we came to was, for instance, an example with strings. I have a variable that is a name, it's a string, the value is Jean-Michel, it's very French. And what we do is we wrap it, we give it an alternative value and it turns it into a different object
14:02
that has an original value, Jean-Michel, and an alternative value which is redacted. So what we do then is we wrap the callables. For instance, if I want to print the name, the object will call the dunder-aster method
14:24
and the method has been redefined to check the context. Am I supposed to show the original value or show an alternative value? If it's supposed to be redacted, then I return redacted and of course, if not, I return Jean-Michel. So next, for the fields, in the database,
14:42
we have a lot of customers. So we have, for instance, a table with a type of vodka with Jean-Michel. And I have this new field now, so I need to define a new mixin. And this mixin just redefines two methods from db value. So from the database, we wrap the value
15:01
and the pre-save method that unwraps the value from the field to the database. We also have a model mixin. We just redefined the set, the dunder method set hatch to wrap the value of fields that contain personal data. So if I do customer.name equals Jean-Michel,
15:20
this is the method that it's called. And to help with all that, I have two context decorators. So it's both a decorator and a context manager at the same time. Hide personal data and show personal data. And we can imbricate them. So remember, we had the logs at the beginning, so a very quick recap about logging. I have a message, I have a level.
15:42
I give it to my Python object, the logger, which has several handlers maybe. A handler can be logged to a file or to the console or send an email, whatever, and I can add a formatter. So what I do is, when I don't want to show the personal data, I just use a decorator on the formatter.
16:01
If I, for some reason, want to show the personal data, I can use the other decorator. This is how I can obtain this very nice redacted log. So what are the next step? Obviously, this is very, very, very simplified. There's room for improvements, and the next step is, of course, open sourcing.
16:24
I still have one minute. So as a bonus, also we have custom template tags. How do we do that? In the template node, we check a permission to see if we can, if we should show or hide the value.
16:42
And this template tag can be used with filters. So for instance, I can do a hello with the customer name. I just need to give it the variable with a filter, in this case, an uppercase filter, and give it the permission condition. Also works with a form,
17:02
and I can just add the bootstrap filter if I want to. If you don't know what GDPR is, it's a little late, but there was an amazing talk last year at Drunk on Europe 2018. It was by Will Hardy. It was called Protecting Personal Data with Django because it's the law.
17:20
And this is for me, all for me. Thank you. Thank you, Francois. Bonus points for having a hyphen in someone's name. I like it. All right, so we've, Juan has converted his entire street and taught the entire street about this simple message
17:42
about how to live your best life. And it doesn't take long before, when something like that happens, that the government finds out. And so the local city found out about it, and they were interested in finding out about this message. We'll find out a little bit more about that after Sascha Romijn introduces us to a different secret. Take it away, Sascha. Thank you.
18:03
So if you've seen me around, or if you've been to more DjangoCons, you may have seen me hand out these delicious little cookies called Strohpaffels. I bring them from Amsterdam. They're like two waffles with some gooey sweet syrup in between. Very tasty. I've been doing this for a long time.
18:21
I've been bringing them to DjangoCon for years, at least. So far, I've been involved in handing out about 56 kilograms of these cookies, of which 16 kilo was sugar. So I've contributed about 255 million calories of Strohpaffel to open source communities. This is enough for an adult to live on for six months,
18:42
but you would not feel well. And then there's also the Secret Society of the Strohpaffel, which started some years ago. And you can actually become a member. There's a small initiation ritual, and then you can get your hand stamped with our logo.
19:00
The secret is I don't actually know how many members there are because the stamp fades after a day, so I can't keep track. I think we have about 300. And why am I doing all of this? When I meet new people here also, they ask, what is the deal with the Strohpaffels in the Django community? And I do it because it's just really fun.
19:23
Because when I meet people for the first time, sometimes they're initially a little wary, like strange person from Amsterdam, I'm handing out some food. I get asked a lot whether there's weed in it. And people who know me, they sometimes get really enthusiastic, like I've had people run down the hallway when they saw me again to ask whether
19:42
I brought any Strohpaffels. And so the fun is mainly in like how enthusiastic people get about this, because these cookies cost me about six cents. So it's not like a major effort. And basically the reason is, for me, like it's not just about the cookie,
20:01
or I don't think it's just about the cookie for these people. It is also bringing them a little bit of happiness. It's a random gesture of kindness, even though it's small, and that matters to people. So in a way, the secret society of the Strohpaffel is actually the secret society of happiness.
20:21
And when we think about happiness, we often talk about, we often think about very big things about your life partners, about getting married, about children, about moving to a different country. And if you recognize the colors on my shirt, you'll know I know some things about big changes. But we often tend to forget how it can also come from
20:42
really tiny things, that really small acts of kindness, small gestures can make a really big difference. They can make someone feel better after they've had a bad day, or something happened, or they're just not feeling so well. Small things can add up for them.
21:02
And one of the ways in which you can contribute to this is a project Mikey mentioned earlier, Open Source Happiness Packets, which is basically a platform where we try to get people, mainly in open source, to say nice things to each other. So if you saw a talk from a speaker that you really liked,
21:20
or you had a conversation with someone that made you feel good, or you learned something, or it cheered you up, then you can send them a Happiness Packet. We've had 930 cents since we first launched this in Budapest, and a lot of them are public also. And so some of my favorites include, it is people like you that make me truly happy
21:42
to be involved in open source. These are public with permission, and you all deserve way more praise and accolades than I can possibly give. And there are another hundred public on the website. So we've had 930 cent, and there are enough people here that I'm sure we could get to a thousand.
22:02
I'm sure there are a lot of people here who've met someone that they appreciated, something that somebody did for them, maybe it was a commerce organizer, maybe a speaker, a volunteer, anyone really. But also, Happiness Packets are not the only way. There are so many small acts that we can do,
22:21
that maybe we don't even think about so much ourselves, that don't take so much effort, but they can make a big difference to everyone else, to someone else. Don't all start bringing unhealthy foods, because that doesn't scale, but there are many ways. So my name is Sascha, I've been called the monarch of straw-paffle-based happiness.
22:42
Please join the Secret Society of Happiness. Thank you, Sascha, while our next speakers get set up. So Juan has been called on by the state, by the local city government.
23:01
They've invited him into a meeting. Juan goes into this meeting so that he can help share this message about how he lives his best life, the message that he shared with his neighbors and the rest of the people on his street. And the government's really, really interested about this and wants to expand the program. We'll find out more about what they did after Karina and Jessica talked to us about Pinam Scholars.
23:20
Good afternoon, everyone. So my name is Jessica and I want to talk to you about Pinam Scholars. Pinam Scholars is a subgroup of the Python Namibia Society and they are Python coding clubs in high schools. Okay, so one of the things that we have always
23:41
been struggling with is computers. So this picture was taken at one of our Friday classes. We have two hour classes on every Friday except for when it's school holiday or when the kids are going home. So we have always struggled with computers, as I just said. And we have done plenty of things to overcome this or be able to practice even without computers.
24:04
So what I want to say that I have not really said in a lot of talks that I have had is to thank the Cardiff University because they've always, when they have a representative coming to Python Namibia, they've always brought at least one computer
24:21
that they are not using. And that's one of the computers that we are using there. So we share them, we have four now, and we share them. Some break and so forth, but currently we have four that are working so I want to send them a special thank you.
24:40
So one of the things that we do is what we call Computer Day. I've spoken a lot about this, or extensively about this at DjangoCon Europe 2018. So if you want to know how we do it and know in depth about it, you can watch the video online on YouTube. So what we have been trying to do this year, what we are trying to plan to do
25:01
is that we extend it to be a six-day training instead of just a two-day conference because we have heard schools from villages that joined the society and we don't want them to come all the way just to come for a two-day conference. So we want to change it and extend it for six days. So if you want to be involved in terms of coming to be a mentor
25:22
or a tutor or teacher about something in Python, we are more than happy to have you on the team and collaborate with you. Yeah, so we have had six schools now this year that joined the society, so we are quite happy about that and that's one of the schools in the north and that's what happened after we drove 13 hours
25:43
to go to that school. So that's why we want to extend Computer Day to be a six-days thing instead of just two days. So one of the things that happened this year is also that we finalized the partnership with NSDO and ASB Hamburg. So NSDO is the Namibia Sun Development Organization.
26:04
So they give matrices, school desks, use computers that are donated by ASB Hamburg and I heard about them through, I've been a teacher for three years and I heard about them through a parent because I was always complaining
26:21
about the lack of computers at the school and things like that and then she introduced me to this guy. So when I spoke to him, he told me, no, we give computers to primary schools and we give computers to schools that are dominated by the Sun community because they are marginalized. And so after a few meetings, I convinced him to give computers to schools that are not dominated by the Sun community
26:42
and secondary schools. So this year we had our final meeting and we met the ASB Hamburg group and we are now going to receive computers from them. So they are going to be, let's say giving a full computer lab or like 20 computers to a school and then we give them like an amount of money
27:03
to help them cover the cost that they incur when the computers come. So Namibia has about 1,000, they have more than 1,700 schools. So we have a long way to go. They are not going to help. So we have had a couple of things
27:21
that we also try to do that we've been doing to try and raise funds. And Karina will be talking to you a little bit more about that. I met her at Young Okon Europe 2018 and she has helped me, especially with the emotional wording of things and things like that. So she's going to talk to you a little bit more
27:40
about her ideas. Hello, I'm going to talk more about the ways that we could help to contribute. Well, there is a Patreon link. We will post it on Slack also
28:01
and you can donate directly here on the link. But also you could get more creative ways, could find more creative ways to do this. For example, well, I myself, I pledge to give a free one-day beginner lesson
28:22
for three people who, in London, so you can, but you can also do the same, but maybe something different like guitar lesson, or you could make a plush Django pony, Django pony, or maybe you have some other ideas
28:44
to give us rewards for other people who donate to this project. Thank you very much. Okay, so we have one last speaker.
29:00
This, the local city government has found out about one. They've met with one. They've come up with a grand plan for, you know, we can do this. This is actually quite a simple thing to do. And, but unfortunately, before they actually got to the point where they were able to deploy this grand plan out, Juan was abducted, and the abductors took him out to a golf course.
29:23
And it was there in the middle of the golf course. And they were trying to stop him because they didn't want the whole society to change. They liked things the way they were. And there was, you know, there was a, it was tense. There was yelling. Juan's a very nice guy, very calm guy, obviously, living his best Danish life.
29:42
And there was this, there was a struggle. And unfortunately, Juan was shot. And we'll find out what happened after that after we have Krzysztof Bujanowicz. Hi, I'm Krzysz. You can find me on GitHub and Twitter with my handle, at Bujanowicz.
30:01
I'm currently working at Plecto. I'm a senior software developer and head of Orso office. And I'm going to talk to you really quickly about keeping a request-wide state in Django. And that's not to be confused with global state because global state is very bad. It lacks isolation. You can leak pretty much anything to another request.
30:22
So for example, user data and Django tries really hard to get rid of pretty much all instances of global state that are still there. And we should be striving to do as well in our applications. An example of request-wide state is, for example,
30:41
internationalization in Django. So whenever we use the i18n framework, which includes also the middleware, we're actually not passing around the language around. We keep that in something that's called thread local storage. And as a matter of fact, it doesn't have any magic
31:02
involved, it's just using common Python construct in such a way that allows us to obtain and read the data from any point in our application, including our library code at any point in a request cycle. So a really quick code example is
31:23
we can have a state file which just uses one simple import and a pair of getter and setter. And we can use that from middleware to set the object at the beginning of a request
31:41
and then reset it at the end of the request. That's fairly important because we don't want to leak the data to later requests. And at any point after this middleware runs and before it returns, we can access the data.
32:00
So you can put anything you need in the application, for example, library code or some custom code related to location and geographical bindings, for example, or maybe you want to keep the request itself as in this example for debugging purposes.
32:23
Yeah. And you need to use it with caution, please. Don't abuse that. You generally still want to pass variables around like in normal, like any responsible programmer would do.
32:40
That is pretty much still a global state but it's bound to one request. So you just solve some issues with isolation but it's still a bit messy and indirect way. It just helps resolve some issues. Okay, so that's it. I think we have two more minutes left. That was quick one. Thank you. Thank you.
Recommendations
Series of 32 media