 Hello, yes, I'm just Stefan. My name is Wiertel, but I like Stefan just that This story is just about Firstly it's a real pleasure to present my experience to you because sometimes I don't like to expose something Firstly it's my first talk about Django. I'm not a fan of Django I prefer flask but because assign a contract with Django for Django, but I started to use Django I'm not an expert just a newbie a beginner if you have some Advice you can give me you can send me your message About the rest Yes, only develop some backends web services with Python, of course, I think I oh maybe we've go long or a long It's my biography On the left is just a draw of my daughter. You can see there is a big snake On the center. It's me. I am a Python lover Of course, I use open source a developer open source. I open source is just my life since 20 years and I just created the Python for them. You can come for the next year and what else? Yeah, I am a member of the PSF of EPS. I receive CSI from the PSF because I just created the Python for them Yes, just that so For presentation, I need a use case and in this case in this story I'm going to use there are you're a Python website. Okay, I Precede the work with which has be done by the current developer of Europe I turn website We know you're a Python is just a know some project. We are there that really that's really awesome Because we saw what you're Python or Python Python is not the fabulous project Thank you So this even has been organized by some people and there's people the organizer are the main developers of Python of Europe, I don't say We have some war groups in Europe. I don't we have the financial group The support group and of course a marketing group and there is the web team group. I am in this world group my first contribution to the website was in 2015 sorry, I'm not French. I'm not English And when I have time I contribute to the project But when I have time and maybe that's the main reason why I'm not a big contributor But is this year? Just explain that assign a contract to a developer to be a jungle developer. Okay. I'm a normally I'm I am a Python expert and I know flask Maybe jungle is not really difficult. Okay So if you want to read the source code of your Python the website you can go on this address Okay First you can contribute So you're a python though the website of your Python. It's not just a facade It's not just a small site where you can see the speaker or just the attendees and the rest With Europe I turn we can do the conference management We can manage the tickets for the assign and assign or just our friend tickets You can come we can do some statistics about the attendees the speakers and the rest We can also make the invoices or just the refunds. I cannot come. Can I can you refund me? Okay, maybe When you send an email to the support because you have an issue with one person or because you have another program, whatever There is the help desk and this help desk will use your Python the Europe Python site Sometimes you receive some notification by email. We don't use any other system any external system We don't use a WBS or just Mailchimp But sometimes and you don't know that but with the last version of Europe I turn We can do The booking for the rooms for the hotel and of course for the sim cards But we try to remove this card because it does not work But yes, we can do that so The website if you can is a really good tool because it's not just a simple website It will handle the invoices the refunding and the rest But sometimes we need to do the state of the union Firstly We use Python 2.7 The support will stay will stop in 2020 and We use Django 1.8 No, okay The the last migration to the Django 1.8 is be done in the last year during the last Europe item We use some dependencies, but there's dependencies are just broken with the new version of Django There's no maintenance That's very boring Of course, we use a scale light Sorry, the best is just after we have no test Can you start to come back? Yeah, we have 100 or 200 files and 27,000 lengths of code and no test and No documentation Sometimes we can read and you can check in the source code the chemist are just in Italian We are just some English speaker That's right, and we understand English or French or Italian for Okay Sometimes we can see in the source code of Europe item Some parts of the code the code is just duplicated or we can see some dead code why because During the migration from the last Sorry for the history the previous version of Europe items the Europe item site was based on the Python Italia site That's the reason why we have the commands in English in Italian and They use several apps application With a new version of Europe item we just merge them Okay, and that's the reason why we have some duplicated code Of course, no, I think I think for us no continuous integration And no API for the external tools are in fact we have nothing Okay, but and no c-slug, of course. Yes, the settings are coded. I think we have a But say usually I think We are not alone in this case because I'm a freelancer of with Python And when I go in some companies, I can see the same case another commutation Uncontinuous integration server in fact nothing Yes, it works. Okay, I Don't forget one thing because we are at her a Python Europe items are started in 2002 and Since the beginning we have a lot of former developers in reality 31 developers Secondly, we are some volunteers on the free time Just that we are not paid for that. It's not the case for the companies and We are not web dev just that a scientist back-end dev We try to to fix the issues Okay From that I think we have a real challenge Maybe a small maybe a big We have a rare challenge the first challenge is to have a continuous integration server Okay, we can install GitLab. We can use in GitLab or maybe Travis. We will see that in the future We need documentation not in Italian maybe in English Why not in Flemish? English is better For the configuration that's very important because currently the settings are just arcaded in the south code That's very boring when you want to to move from the prediction to the staging to the production server That's very funny. We need some tests Maybe refactoring the dead code remove them Of course improve the quality of the code to that That's very important the profiling Sometimes we develop some application with Django, but we don't use some tools some funny tools We need to improve the deployment. I Don't know for you, but I need some companies they copy some script from a wikai wiki, sorry and They passed all the lines in a shell because they don't know fabric and unseeable or so stack and We need to monitor everything the website He's responding or not to the database. There is a shutdown or not everything About the continuous integration We have good news I have a good news I started to use Travis just a configuration. It's not really difficult Okay For the documentation What's the best project we want? maybe things I Like things because we have just the syntax and we can extend it and Because we have a lot of plugins for Django About the configuration we can start to to change the source code and just You are just use Django that and that and is just a small file where you input you put your configuration you can see that in the part of the top where you Give the the the configuration for postgreSQL for the secret for the the debug environment and the rest and In the bottom it just Lines of code that you have to put in your manage the pie. That's very funny With that you don't need to change your configuration with the settings the pie I have seen some developers. They comment the source code the settings and try to use the other part for the test please Just please Use unit test or pay test. Don't try to make your own framework. I see that that's very funny It's just I Use by test and I'm going to show you that because yeah, there is a funnest a good project by test profiling But please use a framework. It's a basic requirement requirement and Don't believe that your code is just perfect. We are humans and the human make a lot of error in this life, of course so When we create some tests How to create a test we create a function For the test and after we implement the code But we have a legacy code. It's not the case You have the legacy code and you have the test you want to try to write the test Maybe you can write the test in function of the code coverage of your application in this case You can use coverage or just if you are using by test by test dot-cov That's true just for the source code, but sometimes you are using some templates and In the templates you are not sure that your templates is just used with the right function Example you want to add a new parameter to a new an endpoint and you have to check all the templates Okay, you can cry you can try to create Test for each templates, but there is a plugin for that Jungle coverage plugin this small plugin will analyze the template. It will give you a Just a small report. Okay, there is an error in this case just that Because we use the version the version 1.8 since this version The migration and giant of Django will execute all the migration file and sometimes that's very boring But with a BB because the test will take two seconds and the migration two minutes With just this plugin We can disable the migration When you try to write to your test that just more important, that's better For the rest we have some models I suppose who used the fixture bad Sorry. Yes, that's bad. Why because we have a static file and When we have did the model we had a new field you have to have that your fixture I don't know for you, but in the companies where work They try to Implement a small script where it will put some values for the new field and my case. I just use factory boy Create a factory for the model and from that I can implement a new instance of my mother Just when you write the code on or when you want to refactor your code You can use pyflake or just by lint Just some linter where they tell you where you have an error in the source code. For example, you don't you just forget to Declare a variable Use a variable, but this one is not really it's not in the source code When you develop you can use Django PDB when you have an exception Automatically PDB will start. It's a post-mortem, but automatically it will start on this line where you have the issue the exception And you can start to debug. Don't just print prison just for the The beginners, it's my case If you are using py test, I'm going to use PDB PPP Because PDB or IPDB just does not work does not work with py test, of course Because I'm a contributor of CPyton CPyton 3.6 and 3.7. I like to use my py And we can use my py. My py is just a small tool where we can check The source code we can create an analysis of the source code and give a report where okay This variable is just a string, but you want to assign an integer. It's not correct And my py can give us a report where we have the duplicated code Or just the duplicated function We can use autoflake Autoflake is just a tool Where it will remove the unused import files from the source code and For the import you can use in ISOT. ISOT will and function of your configuration Will solve the input the import side By three groups for example for the stonda library for the intern stonda library the external library Django and whatever and your home library Okay Maybe Django debug toolbar Do you know how they debug or profile an application with Django and my team before I was a lead They take time They start time and they make the difference between the start and the stop just that but we don't know the number of queries in the database and About the CPU we have nothing It's very interesting. I use it. I don't know for you When you run the server with run server You can use Django Django server and the line profiler plugins where you will Get a small report for the profile of the profiler And for each line we get we will get the result for each line. Okay, this line has to as they Takes two minutes or two seconds. Sorry, and the next line will take one minute milliseconds. That's really important Yes for you Python's profiling Python's profiling is just a wrapper around see profile But he has two interesting feature the first one is just profile SVG With this feature, he will create an SVG file and we'll generate the lines where you can see a Sorry, excuse me, you will have a file a profile where you can execute a tool to show you the Graph with the duration the course a number of course the times in the application and You can use the second parameter just durations duration will create we write a report Where you have in this case just the two slow worst function in your source code I like that because sometimes we can have this graph I don't know for you. Sometimes you have a function. You think it's a CPU bound but in fact, maybe there is a problem with this NKO with the DIO In my case, that was just a problem with my network So I'm going to continue with the profiling we can use see profile V See profile V is just a web interface for the prof files You can see just a small screenshot where we have all the stack trace And the course for each function and the times Just need to install it with With people so So for the deployment while using Docker and We use the co-compose, but maybe in the future. I would like to use Kubernetes or the course one Because if we implement a new feature we want to see it before to put it in the prediction server Because we are some developers For the monitoring I would like to use sentry because currently we receive an email Just an email and we have no statistics about this exception. Nothing sentry is really a really a good tool for that Maybe you super facade or super vaza super visual day, sorry or just Kubernetes or the course one because it can restart if there is a crash of the process and For the rest not just or she can so Exploring just the state of the union after this Refractoring because I did it I Have added Travis We have some tests 97 tests. It's not really big, but it's not better than zero We have code coverage 32 percent 32 person on 27,000 line of code. That's good In one week, I think it's good started to port The database to postgres equal the source code start to be compatible with postgres equal and of course Sometimes I use a profiling because I have Observed some difference with the speed and function if we use escalate of postgres equal Next step just Just add the documentation remove the dead code Move to the last version of Django Django 2.0 or 1.11 I prefer Django 2.0 because we will remove the support of Python 2 Of course, Python use Python 3.6 Because we have some improvement and mainly with the last version of Python Python 2 3.7 and some months Use postgres because postgres Is postgres just the perfect database for me? Use celery Maybe we will provide some API because currently you know why the schedule in your application is not Synchronized with the app with the website because every day we just export the schedule from the database to the application And maybe create a single page app so There's an expert a Django expert in the room because maybe we need your help because We are voluntary. We don't have a free time. We are not paid for the Europe item site It's just on the free time But maybe we you have a better experience than me How to contribute during this weekend, we will do a spring code Please come on. Please. I don't want to be alone. Okay, please come join the web team and If you are better than me, please share your best practice You have Survey you can go Just read it. It's tiny real.com slash Django that's best dash practice and If you have a question There's a time there's a moment who has a question This talk is just my experience in one month Okay, I never used Django before And I don't know if I had the right The the right practice for the project but in my case because I already used some other tools in the past Just use this towards Okay No question. Yes, just one I'm in time Hi there So first you can run by test with IPTV is just minus s or minus minus capture equals to no Which will want to redirect the SDL so everything's working with by testing IPTV and Seconds Have you considered the whole team to use at least some Django CMS or waktail as Base on top of which you can build the conference thing For the second question we use Django CMS All right For the first, sorry, can you repeat? There was a slide that you said you cannot run by test with IPTV Because you get some strange event loop error When I with the certain flag Maybe you can show me because when I started to use IPTV with by test I don't know why but sometimes I get some some error in my console But if you have a solution, I'm ready to maybe the test were failing. Yeah, okay Another question. All right. I think we've got time for one more. I'm sorry We've got time for more questions. So Ah, all right And as far as eliminating dead quotes, there's a very good tool called vulture And it doesn't catch up to be everything for obvious reasons, but it does catch an awful lot of stuff It does study code analysis on the code base So that should be useful Can you show me because yeah, I come on All right, do we have a question that is a question Yeah, there is vulture just forget to explain it, but yeah, it's a good project or so Thank you