Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Comment remplacer une chaine par une autre dans le champ d’un Model Django
Je me suis retrouvé il y a quelques temps avec une problématique, remplacer une chaine par une autre dans un attribut CharField d’un model django. La première possibilité était de faire tout simplement une belle boucle sur la totalité de mes instances de module, faire le remplacement en python et sauvegarder la nouvelle valeur. Sauf que j’avais quasiment un million d’objet et que je n’avais pas envie que cela prenne des plombes. Et puis c’était un peu moche. Du coup j’ai un peu fouillé et miracle, j’ai trouvé une solution que voici. On commence par définir la fonction de remplacement, tout en django et en SQL. from django.db.models import F, Func, Value def replace_func(field_name, old_str, replace_str): return Func( F(field_name), Value(old_str), Value(replace_str), function='replace' ) Ensuite, il n’y a quasiment plus rien à faire. On va simplement appeler update sur tout les objets et utiliser replace_func. Par exemple : MonModele.objects.filter(CONDITIONS).update( champ_a_modifier=replace_func("champ_a_modifier", "str_que_lon_veut_remplacer", … -
Django News - 🎊 DjangoCon US 2025, Wagtail Updates, and Tips for Django Developers - Jan 3rd 2025
News DjangoCon US 2025 has been announced! DjangoCon US 2025 is heading to Chicago this September 8 - 12th—mark your calendar, prepare your talk submissions, and join the excitement! defna.org Wagtail CMS Wagtail 6.3.2 Wagtail 6.3.2 includes three bug fixes and a docs update. github.com Articles Database optimization isn't always obvious Database query optimization often defies intuition—Ken Whitesell unpacks why benchmarks, query plans, and context matter more than surface assumptions. github.io Python: create temporary files and directories in unittest Create and manage temporary files and directories in Python tests, with practical tips for unittest and more. adamj.eu Django in 2024 Django proved its versatility in 2024, powering everything from high-traffic APIs to async workflows, while keeping complexity low and teams productive—reminding us why it's still a top choice for modern web development. screamingatmyscreen.com Show Django flash messages as toasts with Htmx Learn how to display Django messages as user friendly toasts with Htmx joshkaramuth.com Getting Started Contributing to Django A collection of resources to help you get started contributing to Django. better-simple.com Introducing Django Template LSP: Smarter Completions for Django Templates - Four Digits Django Template LSP revolutionizes template editing with intelligent autocompletion, navigation, and hover docs, making Django development … -
My 2024 in review
A quick review of my 2024 done in a hurry, trying to remember the many experiences I had, the people I met, the places I visited and the changes I went through. -
Deploying a Django App to AWS ECS with AWS Copilot
This tutorial looks at how to deploy a Django app to AWS ECS with AWS Copilot. -
Django in 2024
2024 was a busy year for me. My clients really kept me on my toes with lots of fun and exciting R&D projects. Nearly all of them were built on the same stack. Some are internally facing, processing about 1.5 million messages asynchronously per day, some are customer facing, with a few hundred requests per second peak, but overall still nothing too crazy. I am sure they will get a bit more traction in 2025. Additional to that we worked on a non profit side project that will likely go online in January. I obviously did not write all these projects from start to finish by myself. For the first four to eight weeks I worked mostly alone on these projects. But during this time there were still other engineers to brainstorm, figure out the API for integration points, get some help with customer specific domain questions and have a project or product manager track down external information that were needed. I was just the lucky one to write code all day and I got to push these things to production for the first time. Which is also the point when we usually brought in more people to add features, … -
Django News - New Django Accessibility Team Members, Performance Pitfalls, and PyCon US 2025! - Dec 27th 2024
News Welcome to our new Django accessibility team members The Django Accessibility Team welcomes new members Eli, Marijke, Tushar, and Saptak, who bring valuable expertise to the project. djangoproject.com Articles Django: avoid using .first() when retrieving a unique object Avoid using .first() to retrieve unique objects in Django to avoid unnecessary performance costs from added ordering; instead, use .get() with proper exception handling for efficiency. github.io This Django Template Tag is Killing Your Performance Avoid performance pitfalls by replacing the length template filter with count() for QuerySet objects to prevent excessive memory and database usage. mirat.dev Better Error Tracking in Django Learn how to enhance error tracking in Django with Bugsink. Explore built-in features, limitations, and robust solutions for debugging and managing errors effectively. bugsink.com Loopwerk: Why I still choose Django over Flask or FastAPI Django's comprehensive features, powerful ORM, seamless migrations, and supportive community make it the go-to choice for building versatile and scalable applications. loopwerk.io Events PyCon US 2025 Registration is open! PyCon US 2025 registration is open, offering flexible rates, early bird discounts, and a packed schedule of events, including tutorials, keynotes, and sprints. pycon.org Podcasts Django Brew: Episode 4: Spoiler Alert: DjangoCon US Recap, Open Source … -
Optimizing SQLite - Building SaaS #210
In this episode, when worked on the newly migrated JourneyInbox site and focused on the database. Since me moved from Postgres to SQLite, I needed to make sure that SQLite was ready for users. We examined common configuration to optimize the database and applied that config to JourneyInbox. -
Django: Fail in templates with {% url '' %}
Previously, I covered using 1/0 to crash Python within minimal typing, useful to quickly answer questions like “does the code even get here?”. Recently, I wanted to do the same in Django templates, to trace if a given template was even being rendered, and under which code paths. It’s a bit more challenging to deliberately crash Django’s template language, since the whole system is designed to be robust, silencing of many kinds of errors. The language is also restricted, so {{ 1/0 }} doesn’t work, as variables cannot contain expressions. Still, after playing around for a bit, I came up with following two options. First, there’s a way to run 1/0, using divisibleby: {{ 1|divisibleby:0 }} On rendering, this raises a classic ZeroDivisionError: ZeroDivisionError: integer modulo by zero That said, divisibleby is a bit long and tricky to type. Second, my preferred method uses the url tag: {% url '' %} The {% url %} looks up URLs by name, so providing it the empty string forces no URL to match, raising a NoReverseMatch error: NoReverseMatch: Reverse for '' not found. '' is not a valid view function or pattern name. I don’t think there is a shorter way to crash using … -
Why I still choose Django over Flask or FastAPI
I started using Django in 2009, and fifteen years later I am still a happy user. Why do I prefer it over Flask or FastAPI? -
Weeknotes (2024 week 51)
Weeknotes (2024 week 51) Building forms using Django I last wrote about this topic in April. It has resurfaced on Mastodon this week. I’m thinking about writing a feincms3-forms demo app, but I already have too much on my plate. I think composing a forms builder on top of django-content-editor is the way to go, instead of replacing the admin interface altogether – sure, you can always do that, but it’s so much less composable… Releases blacknoise 1.2: No real changes, added support for Python 3.13 basically without changing anything. It’s always nice when this happens. django-imagefield 0.21 django-prose-editor 0.10: I rebuilt django-prose-editor from the ground up and wrote about that two weeks ago. The 0.10 release marks the final point of this particular rewrite. django-js-asset 3.0: See the blog post from this week -
Django News - Django 6.x Steering Council Election Results - Dec 20th 2024
News Django 6.x Steering Council Election Results Congrats to our new Steering Council members. Carlton Gibson Emma Delescolle Frank Wiles Lily Foote Tim Schilling djangoproject.com Django Reached 100%+ Funding! Django successfully reached its funding goal of $200,000 for 2024. It speaks to the volunteer-nature of the project that something with so many moving parts and active contributions can thrive on such a relatively limited budget. djangoproject.com Python Insider: Python 3.14.0 alpha 3 is out This is an early developer preview of Python 3.14 featuring several major new features compared to Python 3.13. blogspot.com Django Software Foundation Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space! Last week we had 14 pull requests merged into Django by 11 different contributors - including 3 first-time contributors! Congratulations to Juan Pablo Mallarino, Ben Cardy, and amansharma612 for having their first commits merged into Django - welcome on board!🎉 Here are some highlights from the recent updates coming to Django 5.2: The migrate and runserver commands now respect the requires_system_checks override, running only the checks tagged with the specified tags. A new hook, get_check_kwargs(), allows for further customization. django.urls.reverse has been enhanced to support query strings and URL fragments, offering more … -
Bootstrap Kamal On Droplet - Building SaaS #209.1
In this episode, I worked to finish the cloud migration to DigitalOcean for JourneyInbox. We started the stream by bootstrapping Kamal on the server. I hit network issues so this stream is split into multiple parts and is of lower quality than normal. -
Docker Image For Kamal - Building SaaS #209.2
In this episode, the second portion of the stream worked on fixing up the Docker image so that we could get the DigitalOcean droplet functional. This is the second stream chunk because I was having network issues and the first stream cut out. -
Postgres To SQLite - Building SaaS #209.3
In this episode, the third portion of the stream covers how I migrated my Heroku-backed Postgres database to SQLite. I finished the migration of my app from running on Heroku to running on DigitalOcean. -
Object-based assets for Django's forms.Media
Object-based assets for Django’s forms.Media The pull request for adding object-based script media assets into Django is in a good state and I hope it will be merged soon. I have been using object-based assets long before Django actually added support for them in 4.1 (since 2016, that’s before Django 1.10!) by using a gross hack. Luckily I have been able to clean up the code when Django 4.1 landed. I have been asking myself at times why I haven’t proposed the change to Django myself despite having been a user of something like this for such a long time. After all, I have been happily contributing issue reports, bug fixes and tests to Django. The process of adding new features sometimes is terribly frustrating though even when looking (and cheering) from the sidelines. It feels bad that adding another package to the list of packages I maintain so clearly seems to be the better way to get things done compared to proposing a new feature for Django itself. I hope processes change somewhat. But I digress. The ProseEditorWidget in django-prose-editor wants to ship CSS, JavaScript and some JSON to the browser for the widget. So, of course I used … -
Django Quiz 2024
Yesterday, I held another quiz at the December edition of Django London. The quiz is a regular tradition at our meetup, a way of having a more relaxed event in December and giving away some nice prizes. This was the sixth quiz that I’ve presented, and the seventh overall. Here’s an action shot taken by my co-organizer Çağıl: And below is the quiz itself, so you can try it at home. Answers follow at the end, with some extra explanation. Dates refer to December 2023, so if you’re reading in the future, take that into consideration. Enjoy! The quiz 1. What is the default port that runserver uses? 8080 8000 8888 404 2. In which month of this year was Django 5.1 released? May August October Undecember 3. What company initially developed Django? Instagram Mozilla Lawrence Journal-World ACME Web Frameworks Inc. 4. What is the CSS selector that ORs a list of selectors? :is() :or() :any() :is-one-of-these() 5. What is the name of the new middleware that requires authentication by default? LoginRequiredMiddleware AuthenticationMiddleware PrivateEverywhereMiddleware FinallyNoMoreAccidentallyPublicViewsMiddleware 6. What is the name of the Django contributor accelerator program? Djangonaut Space Pony Express Astronaut Django All Djangoes Go 7. Which model field would … -
Reflections on DjangoCon US 2024: Highlights, Takeaways, and Community Connections
DjangoCon 2024 was a resounding success for the community, with attendees from all over the world gathering to learn about the latest developments in Django and to connect with the Django community. Caktus was well-represented at the conference, with six of our team members attending. In this blog post, we share our experiences at DjangoCon 2024, including our favorite talks, the people we met, and the things we learned. We also offer some tips for future attendees on how to get the most out of DjangoCon. What did you like most about DjangoCon 2024? Keanya: What I loved most about DjangoCon 2024 was the people. DjangoCon is a celebration of community. I especially appreciated how welcoming the environment was. Whether you’re a seasoned contributor or someone attending their first conference, you’re made to feel like your voice matters. But the best part was the sense of connection. We are all here not just to write code, but to build something meaningful together. Karen: Seeing and getting to catch up some with Django community folk that I only get to see maybe once or twice a year at DjangoCon events. Tobias: For me, DjangoCon 2024 was my first US-based conference since … -
HTTPS for Django Development Environment
Certain modern website features require HTTPS, including Progressive Web Apps (PWA), WebSockets, camera and microphone usage, and geolocation detection. However, the default Django runserver command can only run the web server under HTTP. Is it possible to have HTTPS in your local development environment? Surely, and in this article, I will guide you through how to set it up. How TLS/SSL certificates work First of all, let's have a common ground on how the HTTPS work. HTTPS is what makes websites secure, protecting transferred visitors' data (like passwords or credit card info). TLS (Transport Layer Security), which replaced SSL (Secure Sockets Layer), is the security tool that works behind the scenes to create the safe connection between a client (like a browser) and a server by encrypting the data exchanged. They work using a public key (shared via the certificate) and a private key (kept secret by the server) to establish encrypted connections. These keys are often stored in BASE64-encoded files with extensions like .pem. A Certificate Authority (CA) is a trusted organization or entity responsible for issuing and managing digital certificates used in TLS/SSL encryption. Trusted Certificate Authorities verify the identity of website owners and sign their certificates to … -
Django News - Django 6.x Steering Council Candidates - Dec 13th 2024
News Django 6.x Steering Council Candidates There are 12 individuals who have chosen to stand for election and written statements of intent. Existing individual members are eligible to vote. Voting is open until 23:59 on December 17, 2024 Anywhere on Earth. djangoproject.com PSF Fellow Membership: Welcome 2024 Q3 Fellow Members! Congratulations to fellow Djangonauts Jay Miller, Kojo Idrissa, and Trey Hunner, who are now Python Fellows. python.org Django Software Foundation DSF Board monthly meeting, December 10, 2024 Meeting minutes for DSF Board monthly meeting, December 10, 2024. djangoproject.com My first DSF board meeting New DSF Board Member Paolo Melchiorre describes his first meeting and a behind-the-scenes peak at how Django is actually run. paulox.net Updates to Django Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space! Last week we had 20 pull requests merged into Django by 15 different contributors - including 3 first-time contributors! Congratulations to Oleg Sverdlov, Ülgen Sarıkavak, and Joel Burns for having their first commits merged into Django - welcome on board! The following security issues have been addressed: Potential denial-of-service in django.utils.html.strip_tags() Potential SQL injection in HasKey(lhs, rhs) on Oracle The affected versions are: Django main, Django 5.1, Django 5.0 and Django … -
1Password and DigitalOcean Droplet - Building SaaS #208
In this episode, I continued a migration of my JourneyInbox app from Heroku to DigitalOcean. We configured the secrets using 1Password and created the droplet that will host the app. -
UV and Ruff: Next-gen Python Tooling
Dive into the dynamic duo of modern Python development – UV and Ruff! -
pretix - Raphael Michel
pretix and on GitHubrami.ioDjangoCon Europe 2023 | Building and scaling a live event platform with django-channelsDjangoCon Europe 2024 | Fast on my machine: How to debug slow requests in productionBuilding a business on open-source applicationsDjangoCon Europe 2020 | Security strategies for multi-tenant applicationsDjangoCon Europe 2019 | Plugin architectures for Python web applicationsDjangoCon Europe 2017 | Data internationalization in DjangoDjangoCon Europe Organizers Support Working GroupAnnouncing DjangoCon Europe 2025 in DublinSponsorsThe Stack Report - Carlton's Monthly Premium NewsletterLearnDjango.com - Free Tutorials and Premium Courses -
My first DSF board meeting
Thoughts and insights aboutr my first meeting as a Django Software Foundation board member. -
Thinking About Risk: Mitigation
So you’ve identified a risk — now what do you do about it? Here’s a simple framework to help frame discussions about risk mitigation. It’s intentionally very simple, a basic starting point. I’ll present a more complex framework later in this series, but I want to lay more of a foundation before I get there, so we’ll start here. -
Weeknotes (2024 week 49)
Weeknotes (2024 week 49) Django Steering Council elections I have been thinking long and hard about running for the Django Steering Council. I think there are a few things I could contribute since I’ve been using Django for 16 or more years, and have been working on, maintaining and publishing third-party apps almost all this time. I have also contributed a few small features to Django core itself, and contributed my fair share of tests and bugfixes. The reason why I haven’t been more involved was always that I feared the review process with what I perceive to be a too unrestrained perfectionism. Teaching people is good, but I fear that those who teach are self-selected survivors of the process, which come to appreciate the perfectionism a bit too much. It’s somewhat the same as with the Swiss naturalization process – the hurdles are very high, and some of those who weather the process maybe are or grow to be too fond of it. An important point is that this has nothing to do with being nice (or not). Everybody has always been great, maybe with the exception of myself back when I didn’t understand that the problem wasn’t the …