Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
How to Patch Requests to Have a Default Timeout
Python’s requests package is very popular. Even if you don’t use it directly, it’s highly likely one of your dependencies does. One wrinkle in requests’ design is that it has no default timeout. This means that requests can hang forever if the remote server doesn’t respond, unless the author remembered to add a timeout. Issue #3070 tracks the discussion on adding such a default timeout, but it has been open several years. httpx learned a lesson from this and it has default timeout of five seconds. This “missing default” has caused several production incidents at my client ev.energy. Remote server outages caused background tasks to take 45 minutes instead of 4.5 seconds, waiting for responses that wouldn’t come. This caused other important background work to be delayed, with knock-on effects. Auditing the codebase to add missing timeout parameters only got so far. New third party and first party code “slipped through the net” and was deployed without a timeout. I came up with a solution to change requests to use a default timeout. I did so with patchy, my package for patching the source code of functions at runtime. Patchy provides an alternative to monkey-patching with a few advantages: it … -
Building a Single Page Application with Python and Pyodide - Part 1
In this tutorial, you'll build a Single Page Application using Python and Pyodide to manipulate the DOM and manage state. -
How to Learn Django (Ep2 Replay)
Learning Python via Django Considered HarmfulDjango Girls TutorialDjango for BeginnersInstall Python3 on Mac/Windows/Linux/Chromebookawesome-django repodjango-vanilla-viewsClassy Class-Based Views siteDjango Deployment ChecklistGroupsDjango Users Google GroupStack OverflowSimple is Better than Complex Community BoardSubreddits: LearningDjango and DjangoDjango GirlsDjango MeetupsSupport the ShowThis podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter. -
Checking References: Yes, You Should Check References
Reference checking isn’t optional: it can save you from making a big mistake. Reference checks are your last line of defense against hiring a jerk. -
Don’t Mock What You Don’t Own in 5 Minutes
One of the most common issues programmers have when they try to test real-world software, is how to deal with third-party dependencies. Let’s examine an old, but counter-intuitive principle. -
How to optimize PostgreSQL queries from Django using pgMustard
Slow queries happen, and when they do, it can be tough to dissect why they’re slow. This difficulty is compounded by using Django’s ORM, since it generates the SQL for you, so you may have little idea of the actual queries “under the hood”. In this post we’ll look at what pgMustard does and how to use it with the Django ORM. (Disclosure: I know pgMustard co-founder Michael Christofides, but I have not been paid for this post. I just like the product.) pgMustard… Is This a Mustard? PostgreSQL has an EXPLAIN statement to obtain a query plan for any given SELECT query. This plan contains structured performance data, and can contain both planned and actual metrics. Query plans are great, but interpreting them requires a broad understanding of PostgreSQL, and knowledge of what to focus on first. I ofetn find understanding query plans overwhelming. This is where pgMustard enters the picture. It takes a query plan, visualizes it, and provides interpretation of the results. It ranks opportunities for optimization out of five stars (five = most optimizable) and provides detailed information about what you can do next. For example, here’s one of their demo visualizations: This query took 55 … -
Django News - Last Chance for a DjangoCon Europe 2023 - Jun 17th 2022
News Get PyCharm, Support Django Until June 20, you can purchase PyCharm Pro at 30% off, with all of the proceeds being donated to the Django Software Foundation. jetbrains.com Last Chance for a DjangoCon Europe 2023 There will not be a DjangoCon Europe 2023 if the DSF board does not receive viable proposals for one by August 10 End of Day AoE. There is not sufficient time after that for an organizing group to plan a DjangoCon to happen in the traditional and calendar blocked window of April-June. djangoproject.com The PSF's 2021 Annual Report The Python Software Foundation published its 2021 Annual Report, including comments from its new Executive Director Deb Nicholson, outgoing Board Chair Lorena Mesa, financials, grant funding, and much more. blogspot.com Sponsored Ad Affordable Heroku-like experience for Django. Spin up a production-ready Django application, Postgres DB, and Redis in 5 minutes on AWS, DO, or any other provider. appliku.com Articles Utilising caching in your applications A detailed look at improving application performance with select_related, prefetch_related, and caching. django-cms.org Share editor settings with EditorConfig Marijke Luttekes shows us how to use EditorConfig to fix common team formatting issues. marijkeluttekes.dev The End of Localhost A prediction of the future … -
DORA Metrics: the Right Answer to measuring engineering team performance
“What metrics should I use to measure my engineering team’s performance?” Believe it not, there is a Right Answer: the so-called DORA metrics. -
Making a Compelling Offer — in this economy?
An edited transcript of a talk I delivered at the CTOCraft Hiring MiniConf. How do you make a job offer that’ll be accepted when other companies are out there offering candidates over a million dollars? -
New App In Project - Building SaaS with Python and Django #136
In this episode, I broke ground on a brand new feature. The feature will be a task checklist for teachers. Since the checklist is directly for teachers, I created a new Django app named teachers and showed how to hook that into the rest of my Django project. -
New App In Project - Building SaaS #136
In this episode, I broke ground on a brand new feature. The feature will be a task checklist for teachers. Since the checklist is directly for teachers, I created a new Django app named teachers and showed how to hook that into the rest of my Django project. -
Rotterdam (NL) June 2022 python meetup summaries
(Some summaries of a talk at the June 2022 Rotterdam python meetup). Leveraging Python for secure medical image data transfer to the cloud - Ronald van 't Klooster (Quantib) Usecase: they want to use python to connect a hospital to the cloud to upload radiology images securely. Imagery of patients, so it has to be really secure. And in their case also certified. Radiology images are normally in the "DICOM" format. There's a special dicom protocol to transfer images, both for sending and getting images. A computer that implements the protocol is a "dicom node" and can be used by many applications. The image format is mostly jpeg (actually a set of images: cross-sections of the brain, for instance) plus metadata. They have an AI program to help diagnose images, with a microservices based architecture using docker+django. It used to run inside the hospital on their network. They wanted to move the AI server to the cloud. But how to get that working while still retaining their certification? This means that the actual certified AI server program cannot be changed. The solution was to use an open source DIOCM node software called Orthanc. With a nice REST interface, so usable … -
Choosing a Django Version
One of the first things you need to do when starting a new Django project is to choose which version of Django you are going to use. At any given time, there could be as many as three supported Django versions available to choose from: previous long-term supported version (LTS) current LTS latest official version I'm excluding pre-releases from this list which should only be used for testing. What are you optimizing for? The first question to ask yourself is what are you optimizing for. When we are building applications for our clients we are almost always optimizing to reduce costs, both during the initial development process and in support post-launch. For this reason, we are choosing versions which meet the goals of maximimizing interoperability with the Django ecosystem and minimizing maintenance (aka toil) down-the-road. Unless you are working on a hobby project and want to play with new features, I'd argue these goals are universal. Notes on Django Versioning Django does not follow the semantic versioning standard strictly. Versions will always be made up of three numbers (major.minor.patch). Minor version 2 is always an LTS version. After the LTS, the major version is incremented and two minor releases are … -
Choosing a Django Version
One of the first things you need to do when starting a new Django project is to choose which version of Django you are going to use. At any given time, there could be as many as three supported Django versions available to choose from: previous long-term supported version (LTS) current LTS latest official version I'm excluding pre-releases from this list which should only be used for testing. What are you optimizing for? The first question to ask yourself is what are you optimizing for. When we are building applications for our clients we are almost always optimizing to reduce costs, both during the initial development process and in support post-launch. For this reason, we are choosing versions which meet the goals of maximimizing interoperability with the Django ecosystem and minimizing maintenance (aka toil) down-the-road. Unless you are working on a hobby project and want to play with new features, I'd argue these goals are universal. Notes on Django Versioning Django does not follow the semantic versioning standard strictly. Versions will always be made up of three numbers (major.minor.patch). Minor version 2 is always an LTS version. After the LTS, the major version is incremented and two minor releases are … -
Django News - Python Developers Survey 2021 Results - Jun 10th 2022
News Get PyCharm, Support Django Until June 20, you can purchase PyCharm Pro at 30% off, with all of the proceeds being donated to the Django Software Foundation. jetbrains.com Python Developers Survey 2021: Python is everywhere The results of the fifth official annual Python Developers Survey are now available. blogspot.com Python Insider: Python 3.10.5 is available Python 3.10.5 is a bugfix release with more than 230 bugfixes and docs changes. blogspot.com Tailwind CSS v3.1 was released Tailwind CSS v3.1 adds variants, adds better support for importing existing CSS, and adds dozens of new features and bug fixes. tailwindcss.com Sponsored Ad Affordable Heroku-like experience for Django. Spin up a production-ready Django application, Postgres DB, and Redis in 5 minutes on AWS, DO, or any other provider. appliku.com Events DjangoCon US Talks I’d Like to See: 2022 Edition Friday, June 10th AOE is the last day to submit your DjangoCon US talk and tutorial proposals. Jeff wrote up some last-minute talk ideas that he'd like to see. Please note that they will be accepting an additional ten prerecorded talks if travel isn't your thing. jefftriplett.com Articles Django: How to send email without Celery Lightweight emails without Celery. And without a request-response cycle. … -
You Don't Need JavaScript
What If I Told You… You Don’t Need JavaScript. This talk explores why JavaScript is not good fit for most web apps. I then show how most web apps can do dynamic things using htmx. htmx is an extension library to make HTML markup better. I present examples of AJAX fetching and deletion. The presentation includes a dynamic search and how to implement infinite scrolling with a trivial amount of code. -
You Don't Need JavaScript
What If I Told You… You Don’t Need JavaScript. This talk explores why JavaScript is not good fit for most web apps. I then show how most web apps can do dynamic things using htmx. htmx is an extension library to make HTML markup better. I present examples of AJAX fetching and deletion. The presentation includes a dynamic search and how to implement infinite scrolling with a trivial amount of code. -
Handling Concurrency Without Locks
Concurrency is not very intuitive. You need to train your brain to consider what happens when multiple processes execute a certain code block at the same time. There are several issues I often encounter: Failing to recognize potential concurrency issues: It's not uncommon for both beginner and seasoned developers to completely miss a potential concurrency problem. When this happens, and the concurrency issue end up causing bugs, it's usually very hard to trace and debug. Dismiss concurrency issues due to low likelihood: If you recognized a potential concurrency issue, at some point you probably thought to yourself "what are the chances if this happening...". It's very tempting to dismiss concurrency issues when the likelihood is low. However, I personally found that concurrency issues tend to creep up at the worst time - when your system is under significant load and you have very little time (and grace) to come up with a solution. Abusing locks: If you recognized a potential issue and decided to handle it properly, your next step will usually involve some kind of lock. Sometimes locks are necessary, but more often than not they can be avoided, or replaced by more permissive locks. In this article I … -
Read The Docs - Eric Holscher
Eric’s personal wite@ ericholscher on TwitterRead the DocsWrite the DocsAd Funding at Read the Docs and What’s Next for Ethical AdvertisingDjangoCon Europe 2021: Dynamic static sites with Django & Sphinx by Carlton GibsonSupport the ShowThis podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter. -
Django News - Annual Django PyCharm Promotion - Jun 3rd 2022
News Get PyCharm, Support Django Until June 20, you can purchase PyCharm Pro at 30% off, with all of the proceeds being donated to the Django Software Foundation. jetbrains.com Django bugfix release: 4.0.5 This bugfix fixes three bugs in Django 4.0.4. As ever, the best security practice is to always be on the latest version of Django. djangoproject.com PSF Board Election Dates for 2022 Board elections are a chance for the community to find the next batch of folks to help steer the Python Software Foundation. blogspot.com Sponsored Link Crunchy Bridge - Fully Managed Postgres as a Service crunchybridge.com Articles TDD Practice: Time API with Django The blog post version of a workshop the author ran at DjangoConEU in 2018. Now updated for Django 4.0, learn some TDD (Test Driven Development) tricks by building a small API with Django. brntn.me Debugging Tips And Techniques Multiple debugging and problem solving techniques for Django apps. mattlayman.com Build a CRUD application using Django, React & Docker Step-by-step guide to building a Menu website with CRUD support using Django, React, Docker. dev.to People in your software supply chain A thoughtful piece on recognizing and highlighting the contributors responsible for crucial parts of the Python … -
Debugging Tips And Techniques
In the last Understand Django article, we looked at security. How does a Django site stay safe on the big, bad internet? The article explored some core elements for making Django app more secure. With this article, we will investigate problem solving techniques for Django apps. The goal is to equip you with tools to fix the real problems that you’ll hit when building your Django site. From Browser To DjangoURLs Lead The WayViews On ViewsTemplates For User InterfacesUser Interaction With FormsStore Data With ModelsAdminister All The ThingsAnatomy Of An ApplicationUser AuthenticationMiddleware Do You Go? -
Django: How to send email without Celery
<![CDATA[ Django: How to send email without Celery I have to admit that I found sending emails in Django more difficult than I expected since other more complex stuff seemed easier. In this post, I want to share a lightweight approach that I am successfully using for a somewhat lower email volume. While the most basic solution is just sending email in your view code (before you return a response), this is problematic. It will make the response much slower, and if the email fails to send, you have no real means of sending it again. Management command + CRON to the rescue I am currently quite happy with basic management commands combined with CRON schedule that runs every few hours and sends emails. We can keep track of sent emails with records in the database. For example, when I send an email notification that a trial expires soon, I create a record in the database to ensure the email is not sent twice. The model looks something like this: class SentEmailRecord(models.Model): timestamp = models.DateTimeField(auto_now_add=True) email_type = models.CharField(blank=False, max_length=50) to_user = models.ForeignKey(to=CustomUser, blank=True, null=True, on_delete=models.SET_NULL) The email_type is just a field to save the type I have as a constant … -
Django News - DjangoCon Topic Suggestions - May 27th 2022
News PyCon US 2022 Recap and Recording Announcement All 101 PyCon US 2022 recordings are up now on YouTube. blogspot.com Need Suggestions for a DjangoCon US 2022 Topic? Suggestions for topics from the DjangoCon US team. Also applies to DjangoCon Europe! Reminder: DjangoCon US's CFP closes on Friday, June 10th. Reminder: DjangoCon Europe's CFP closes on Tuesday, May 31st. djangocon.us Sponsored Link gumroad.com Events DjangoCongress JP 2022 DjangoCongress JP is back this November. djangocongress.jp Articles Adding GraphQL to your Django App An overview with code snippets of the two main ways--Graphene and Strawberry--to add GraphQL support to an existing Django application. paltman.com Django Friday Tips: Less known builtin commands A look at several less-common Django management commands including diffsettings, sendtestemail, inspectdb, and showmigrations. ovalerio.net Python Standard Library changes in recent years While most attention goes to new features, this article focuses on standard library novelties introduced in Python versions 3.8–3.10. antonz.org Django + memcached + namespace A look at using namespaces to get around not being able to delete keys using a wildcard with memcached. dev.to The Django speaking tour 2022 Paolo Melchiorre takes us on his Django 2022 speaking tour across Europe. It was a fun read for those … -
Brew Install The World - Building SaaS with Python and Django #135
In this episode, I tried to get started after a long break, but my virtual environment was broken. This entire episode is a journey deep into Python installing world. Did I come out on the other side? Yes, we figured it out. You’ll have to watch (or skip to the end) to figure out what happened. :) -
Brew Install The World - Building SaaS #135
In this episode, I tried to get started after a long break, but my virtual environment was broken. This entire episode is a journey deep into Python installing world. Did I come out on the other side? Yes, we figured it out. You’ll have to watch (or skip to the end) to figure out what happened. :)