Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django Best Practices: Template Structure
There are two main ways to organize your template structure in Django: the default app-level way and a custom project-level approach. ## Option 1: App Level By default, the Django … -
Django Favicon Tutorial
This tutorial explains how to add a favicon (shortcut icon) to a Django website. A favicon is a small icon that appears at the top of a tab in a … -
Django Best Practices: Projects vs. Apps
Within a single Django "project" can exist multiple "apps," which are used to separate discrete functionality. For example, a Django website might need an application for static pages like an … -
Django-allauth Tutorial
Django comes with a robust built-in authentication system for users but it does not provide support for third-party (social) authentication via services like Github, Gmail, or Facebook. Fortunately, the excellent … -
Seniority and self-management: you don't have to do this alone
At a certain level of seniority – typically the Staff level for ICs, and the Director level for managers – you’ll be expected to fully own huge areas of responsibility without detailed guidance. The mistake that many people make when they’re new to this level of autonomy is believing they have to do it all themselves. It is absolutely true that, once you reach this level of seniority, you are responsible for a very broad scope of responsibilities, skills, and tasks, but you don’t have to do this alone. At this level of seniority, you have to recognize your weaknesses, figure out what kind of support you need, and take steps to get yourself that support. -
Django News - Django 5.0 Testathon - Sep 29th 2023
News Django Developers Survey 2023 The Django Developers Survey is wrapping up for the year. Please do take a few minutes to fill it out. It is the ONLY way for the Django community to get an unbiased sense of actual usage, which helps guide new features and updates. jetbrains.com Python Developers Survey Numbers for 2022! The results of the sixth official annual Python Developers Survey are now out. blogspot.com Updates to Django As you probably already know, the Django 5.0 alpha is released!!! This means we've now entered a testing period for 5.0 and new features accepted into Django will be part of 5.1. I want to give a massive congratulations to everyone who has been involved in 5.0 - it is a really fantastic release! Last week we had 22 pull requests merged into Django by 11 different contributors - including 4 first time contributors! Congratulations to Toan Vuong, Fabian Braun, Arian and Clément Escolano for having their first commits merged into Django - welcome on board! The final feature of 5.0 was adding support for prefetching GenericForeignKeys via a new class GenericPrefetch. Yet another fantastic feature! You can see an example of how this should be used … -
RTO vs WFH: my default recommendations for remote vs colocated teams
As companies start to roll out so-called “Return to Office” (RTO) policies, I’ve found myself incredibly disappointed by the overwrought, hyperbolic, bad-faith arguments being made by remote work / Work From Home (WFH) proponents. I believe that neither remote work nor colocated work is globally “better”: which one works best is contextual, depending on the role and the needs of the team. In this post I’ll break down how I view that context, and share my “default” recommendations for which teams should be primarily remote, and which benefit from a shared physical space. -
Weeknotes (2023 week 39)
Weeknotes (2023 week 39)Again a few weeks have passed since the last weeknotes entry :-) Moving feincms3 repositories into the feincms organization The feincms GitHub organization has seen more active days when FeinCMS 1.x was still actively developed. Since my interest has moved to feincms3 some years ago I haven’t kept the organization up to date. That has changed this week, and I have moved most feincms3-related repositories into the organization. This move doesn’t change much though, but it certainly feels more official now. Adding scheduled tests I have started using the cronjob schedule feature of GitHub actions to ensure that tests run at least once a month in a few important projects. I want to get notified of changes in Django@main affecting my packages not only when actively working on them. I try to keep up with Django@main in all packages I maintain. Releases feincms3-sites 0.18.2: Many releases in the last weeks. Stopped using permanent redirects in DEBUG mode. Avoid migrations when Django adds more languages. Added utilities which allow restricting model relations to objects in the same site (trickier than it sounds). Added utilities for building full URLs to other sites without taxing the database as much. feincms3-language-sites … -
Deploy to Heroku - Building SaaS with Python and Django #171
In this episode, we did the work to deploy the site to Heroku to make the site live. We configured the production site, fixed some missing settings, and connected to the relevant DNS configuration. -
Django News - Django 5.0 alpha 1 released - Sep 22nd 2023
News Django 5.0 alpha 1 released Django 5.0 alpha 1 is now available. It represents the first stage in the 5.0 release cycle and is an opportunity for you to try out the changes coming in Django 5.0. There are many new exciting features, which you can read about in the in-development 5.0 release notes. djangoproject.com Python Release Python 3.12.0rc3 Python 3.12.0rc3 "is the absolutely last release preview" for Python 3.12. python.org Updates to Django There was a big push to get as many PRs as possible in before the 5.0 feature freeze deadline and so last week we had a massive 22 pull requests merged into Django by 13 different contributors - including 7 first time contributors! Congratulations to Rinku Chaudhari, Anvansh, Lemuel Sta Ana, michele, puc_dong, Yves Weissig and Sam Toyer for having their first commits merged into Django - welcome on board! Some of the final features added to 5.0 were: The main admin content area is now rendered in a <main> tag instead of <div> (#34833) and it's header in a <header> tag instead of <div> (#34832) which improves accessibility. Functions decorated with functools.lru_cache can be serialized in migrations without the need to write a custom … -
My fourth appearance on Django Chat
I’ve once more had the pleasure of joining Carlton and Will on the Django Chat podcast, in Episode #146. We spoke on Tuesday, just hours after Django 5.0 alpha 1 was released, on several topics: Favourite features coming in Django 5.0 My new book, Boost Your Git DX, available now in early access. Some Git tips: autocorrect, global ignore files, and tracking a directory with .gitignore. The future of Git. Making an AI version of myself. My “magic wand” feature for the future of Django. Also, there’s a little easter egg: at 43:35 you can hear my baby boy pushing his “twinkle twinkle little star” walker in the background 😂 Listen on the episode page or your favourite podcast consumption channel. Enjoy! —Adam -
Git and Django 5.0 - Adam Johnson
Django 5.0 alpha 1Don’t create .gitkeep filesNew book, Boost Your Git DXSpeed Up Your Django Tests book DjangoCon Europe 2023 | Good form: How Django’s form rendering improved during the 4.x seriesFossil Versus Git Support the ShowLearnDjango.comButtonDjango News -
Keep content managers' admin access up-to-date with role-based permissions
Keep content managers’ Django admin access up-to-date with role-based permissions Django’s built-in permissions system is great if you want fine-grained control of the permissions content managers should have. The allowlist-based approach where users have no permissions by default and must be granted each permission individually makes a lot of sense to me and is easy to understand. When we build a CMS at Feinheit we often use the Django administration panel as a CMS. Unfortunately, Django doesn’t provide a way to specify that content managers should have all permissions in the pages and articles app (just as an example). Adding all current permissions in a particular app is straightforward when using the filter_horizontal interface but keeping the list up-to-date later isn’t. When we add an additional content block plugin we always have to remember to also update the permissions after deploying the change – and often, deployment happens some time after the code has been written, e.g. because clients want to approve the change first. What happens all too often is that the manual step of updating permissions gets forgotten. This has annoyed me (intermittently) for a long time and my preferred solution has always been to give superuser permissions … -
Edgecase 2023: home automation with an elevator
(One of my summaries of the 2023 Dutch edgecase k8s conference in Utrecht, NL). A nice talk by Erwin de Keijzer. Full title: do you need to take general relativity into consideration when measuring your elevator?. Erwin has an elevator inside his, otherwise quite normal, house. An old lady used to live there and she needed an elevator to get around the house. The elevator is real slow, but handy for moving heavy stuff around. He wanted to do some automation around it... Some rules/goals: Know where the elevator is Add music when the elevator is moving Play announcements when the elevator stops at a floor Don't break the elevator Don't mess with the internal electronics. His first attemt was to use a cheap ultrasonic sensor. The lift shaft was too high, though. And it sometimes picked up the support beams instead of the lift. He now uses the sensor for his standing desk. Attempt 2: "TF Luna LiDAR". A raspberry pi is connected to it and uses NATS and some Go code to write the measurements to prometheus. With the position handled, he moved to alerting. Stuck between floors (you have to keep pushing the button to move), moving … -
Edgecase 2023: wednesday early morning sessions
(One of my summaries of the 2023 Dutch edgecase k8s conference in Utrecht, NL). The truth about kubernetes - Gerrit Tamboer He's one of the founders of Fullstaq (the conference organisers). They started with aws/azure/etc. Working for everything from Around 2019, hybrid cloud became popular. Part in the regular cloud, part in your own datacenter. For that you need it to be reasonably similar on both sides. Now, edge computing is on the rise. Internet of things, CDN edge locations, all sorts of things. A big help for them was K3S. But the core that makes it all possible: gitops (argocd, flux, etc). 2023: kubernetes was released in 2014. So nine years. What's coming up in the near future? We're maturing and lots of cool things are happening. But... for almost all companies, that maturity isn't actually true. Some cloud-only companies that recently started might use kubernetes to the full, but most are slowly transitioning. Common problems are complexity and skill set. Complexity: kobernetes is only part of the solution. 10%. You also have observability, security, advanced networking, ci/cd, data/storage, multi-cluster/multi-cloud... Only after you have all those layers, then you're really production-ready and only then you can start migrationg yout … -
Edgecase 2023: wednesday late morning sessions
(One of my summaries of the 2023 Dutch edgecase k8s conference in Utrecht, NL). Home automation: from scrap to smart - Marcel Claassen He wanted to automate his house. But he didn't want to spend a lot of money. So: lots of second-hand computers, temperature monitors, pumps. The most expensive part was 1000 Euro (new price 3000, so that's OK). Two cheap broken second-hand lawn mower robots that were combinable into one Let's start simple! He had an old analog electricity meter, so he tried to hook up a sensor that looked at the analog meter, but that didn't really work. In 2020 he got a modern smart meter, so he could get cracking. Such a meter has a "P1" port for reading the measurement. He first ran it on a raspberry pi, but in the meantime he's got it running in K3S. A problem was that the container needed full host access to read out the serial port. The solution: a separate "serial2network" proxy that makes the serial data available over the network. Handy! Next up: garden lighting. First a simple sensor + remotely operated switch. Battery life was an issue, as was water resistance and sensor degredation... His … -
Fixing the "Data for this panel isn't available anymore" error in Django Debug Toolbar
Imagine this: you want to optimize your Django project's page loading times. To do this, you've installed the magnificent Django Debug Toolbar that will provide you with the necessary insight into how many queries your page generates. You click on the SQL panel in the Debug Toolbar, and... you get … Read now -
Django News - Django 5.0 Feature Freeze Coming Soon - Sep 15th 2023
News Status of 5.0 alpha release. Last call for new Django 5.0 features. If you have a specific PR you would like prioritized, please let them know by Monday, September 18, 2023. djangoproject.com Updates to Django We are nearly at the 5.0 feature freeze and still so much is happening! Last week we had 11 pull requests merged into Django by 8 different contributors - including 2 first time contributors! Congratulations to Oguzhan Akan and Jeremy Nauta for having their first commits merged into Django - welcome on board! Another amazing ORM feature has been added to 5.0, Django now supports database generated fields! This field can be used on all supported database backends to create a field that is computed from other fields. You can learn more about GeneratedField from the by reading the documentation. Congratulations to Jeremy Nauta, Lily Foote, Mariusz Felisiak, Adam Johnson and Paolo Melchiorre for their amazing teamwork to deliver this feature for us! Django Newsletter Sponsored Link gumroad.com Articles Optimizing Response Time: A Deep Dive with Lincoln Loop Analysis of a performance optimization journey with a large publishing platform using Django that serves hundreds of thousands to millions of page views daily. lincolnloop.com Rendering … -
Django: Move a template tag library into builtins
Django’s template engine has an underappreciated builtins option that selects libraries to preload in every template. Making a library a builtin avoids the need for an explicit {% load %} tag whenever you use its tags or filters. Putting key libraries in builtins can shorten your templates and make development a little bit faster. In this post, we’ll cover how to add a template library to builtins and remove existing {% load %} tags from your templates. Move a library to builtins Imagine you’re using my heroicons package to embed icons from the lovely heroicons. Your templates use the template library like so: {% load heroicons %} ... <button> {% heroicon_outline "beaker" %} Launch experiment </button> You realize that most of your templates use heroicons, making it worth adding to builtins. Here are the steps you’d follow to add it and clean up your templates. First, add the library’s full module path to builtins in OPTIONS: TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", # ... "OPTIONS": { "builtins": [ "heroicons.templatetags.heroicons", ], # ... }, }, ] Second, check it is correctly configured. Remove {% load heroicons %} from one template: -{% load heroicons %} ... <button> {% heroicon_outline "beaker" %} Launch … -
Foss4g.nl 2023: morning session summaries
(One of my summaries of the 2023 Dutch foss4g.nl conference in Middelburg). Community building - Frits Bussemaker Frits has been working for a long time as a community manager. Having a unique question helps in creating a community. You have an answer: it helps if the question is unique. Watch out with the words you're using, though, it is easy to use jargon that few people understand. What is a community? A group of people with a common goal or purpose. Though what people think it is can differ. If you look at a glass from the top, it looks like a circle. From the side the same glass looks rectangular. It is still the same glass. People can look for very different things in the same community. Membership of a community might be free (money). But definitively not free in your time. So pick your memberships wisely. And keep this in mind when trying to start a community yourself: don't start big, but small. See what works, see what doesn't work. Incremental changes and improvements can help you grow your community. But don't ignore the positive effect of those changes on your current members: changes and improvements can help … -
Foss4g.nl 2023: afternoon sessions summaries
(One of my summaries of the 2023 Dutch foss4g.nl conference in Middelburg). The story of maplibre native - Bart Louwers Bart is the full-time maintainer of MapLibre since early 2023. Maplibre is a map-rendering toolkit. Actually, it are two rendering toolkits: one for javascript/web and one for native (android/iphone). Native is the one he maintains. It renders vector data. The output is also vector tiles. Normally, a map server is used for the tiles, but you can also store tiles locally for offline usage. A server for vector tiles doesn't need to be a big machine: the layers he demoed were hosted on a raspberrypi in his basement. Vector tiles need styles. Those are defined in json. This gives you lots of flexibility. Night mode, different renderings for biking or walking, etc. Rendering is done on the client. This needs a GPU. On the web, it uses webgl. On the client it is OpenGL. Only... apple wants you to use their own "Metal" language. They are currently implementing support for that (he showed a quick demo). They are funded by sponsors. Several bigger companies (like Meta) sponsor it as it is way cheaper to do it collectively with other companies. … -
Foss4g.nl 2023: Bellingcat, investigating war crimes and more with open source geospatial data - Logan Williams
(One of my summaries of the 2023 Dutch foss4g.nl conference in Middelburg). (This was the closing keynote, btw). Full title: investigating war crimes, animal trafficking and more with open source geospatial data. He works with Bellingcat. An open source investigation journalism initiative. "Open source" isn't meant in the software way, but it means journalism sources. And then open sources like map info, databases, online photos. You also have gray areas like leaked materials. Bellingcat's first well-known investigation was the MH17 airplane disaster, shot down over Ukraine. In the days after the disaster, social media images and posts started to show up. Geolocatable images of the BUK missile system. Dashcam footage. Investigating individual photos can take a lot of work. Matching scuff marks on the pavement combined with the number of telephone poles in dashcam images... They managed to piece together the timeline and route of the BUK system. The info was even used in the court case in Den Haag. There are lots of sources of geographical information. Maps, satellite data. Images. Reflections in windows. Vessel/airplane tracking data. Most/all commercial vessels travel with location transmitters enabled. They are currently investigating Russian grain ships that illegally transport stolen Ukrainian grain by … -
19X faster response time
At Lincoln Loop, we don’t just build web platforms from scratch and scale them to accommodate growing demand; we also dedicate ourselves to their long-term maintenance. Some of our partnerships have spanned over a decade. Let me walk you through a performance optimization journey we undertook with a large publishing platform, which serves hundreds of thousands to millions of page views daily. The Issue at Hand Over the lifespan of a platform, various infrastructure changes and design tweaks can inadvertently impact the response time. For instance, adding more content to a page or changing the ordering of the results might bog it down. Continuous monitoring is critical because it allows us to spot such regressions quickly. A live website’s behavior varies significantly from local testing. Production sites deal with multiple cache layers and handle countless concurrent requests. In contrast, during “local” development, you typically turn off these cache layers and test one endpoint at a time. Thus, when embarking on performance optimization, always base your strategy on metrics from your production environment and tackle one modification at a time. For this optimization, I utilized AWS CloudWatch for response time metrics on the load balancer and some data from Sentry’s performance … -
Team size isn't a measure of success
Most managers have internalized the idea that team growth, in and of itself, is a unalloyed good, and a sign of success. This is wrong, but it’s understandable. Team growth feels like success, but headcount by itself isn’t a measure of success. Instead, we should judge management success by impact and efficiency. -
Django News - 2023 Django Developers Survey - Sep 8th 2023
News 2023 Django Developers Survey The DSF is partnering with JetBrains to run the 2023 Django Developers Survey. The survey is an essential metric of Django usage and helps guide future technical and community decisions and is open until October 1st, 2023, Anywhere on Earth (AoE). djangoproject.com Django security releases issued: 4.2.5, 4.1.11, and 3.2.21 These security releases address a potential denial of service vulnerability. We encourage all users of Django to upgrade as soon as possible. djangoproject.com Python Release Python 3.12.0rc2 Python 3.12.0rc2 is the last release preview for Python 3.12, scheduled for Monday, October 2nd, 2023. Now is an excellent time to start testing your applications and third-party libraries on Python 3.12 to ensure you are ready for the official release. python.org Last call for DjangoCon US Hotel Reservations DjangoCon US's discounted hotel rooms close on September 15th or as soon as they are gone. Please book today if you plan on attending in person this year. djangoproject.com Updates to Django Last week we had 12 pull requests merged into Django by 10 different contributors - including 2 first time contributors! Congratulations to Gnomeek and John Whitman for having their first commits merged into Django - welcome onboard! …