Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Do I need a consultant, contractor or employee?
When is it the right choice to hire full-time staff, and when should you use consultants or contractors instead? The short answer: hire consultants for guidance, contractors for execution, and employees for stability and flexibility. For the long answer, read this article. -
SendGrid Outbound - Building SaaS with Python and Django #169
In this episode, we took another step closer to deploying the service online. The primary goal was to make sure that email sending works. I spent a lot of time explaining email configuration and showing exactly how to wire up SendGrid to Cloudflare to do Domain Authentication that permits email sending from the service’s domain (journeyinbox.com). -
Django Dependency Management with pip-compile and pip-tools
Even a basic Django project has multiple dependencies. After installing Django itself, various third-party packages--and their dependencies!--must be installed and managed. How do you track version numbers in a reproducible … -
pre-commit with Django
[pre-commit](https://pre-commit.com/) is a widely-used code quality framework. It allows a developer to add [hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) for various code quality tools that check your code for any errors or issues _before_ committing … -
My reaction to the block-driven CMS blog post
My reaction to the block-driven CMS blog post This morning I read an interesting post on the Lincoln Loop blog called Building a Future-Proof Platform with Block-Driven CMS. It shouldn’t come as a surprise to those (few 😄) who know my work in the area of content management systems that the post resonated with me. I found the description of the advantages of block-based CMS editing very clear and I like the emphasis on structuring data well so that it can be reused for multiple distribution channels. Of course django CMS isn’t the only way to implement a block-driven CMS using Django. Since its inception FeinCMS was always the smaller, faster and nimbler counterpart to it, achieving the same basic goals with a fraction of the code and maintenance headaches. django CMS always seems to trail the official releases of Django. django-content-editor and feincms3 are almost always compatible with the development version of Django by way of running the tests with the main branch as well. This allows me to be an early adopter of upcoming Django releases with a software stack that’s already well tested, or also to report bugs to the Django project itself. All that probably wouldn’t … -
Migrating a Django Project from a GPU to a Convenience Image on CircleCI
Recently we learned that as of September 30th, 2023 several linux images will be deprecated, including the one we used, ubuntu-2004:202111-02. Therefore, after September 30th, our pipelines would have failed. To avoid this, we switched several machines in our Django project from Ubuntu GPU images to convenience images; This writing details that switch. Updating a GPU machine image can be a bit tricky. One must ensure that the base image language version and project language version match. Otherwise, updating the GPU image version might result in inadvertently updating the base language version. Resulting, for instance, in a project that uses Python 3.9 and an image (in case of a test image) running those tests in Python 3.11. This might result in issues. To avoid having to constantly update our image, to ensure that our image version is what we intend it to be, and to embrace CircleCI’s current technology we migrated to a next-generation convenience image. According to CircleCI, convenience images are “extensions of official Docker images, and include tools especially useful for CI/CD.” The next-generation convenience images were “built from the ground up with CI, efficiency, and determinism in mind.” CircleCI claims that the next-generation images have a faster … -
Deploying a Machine Learning Model to AWS Lambda
This tutorial shows how to deploy a machine learning model to AWS Lambda. -
Weeknotes (2023 week 33)
Weeknotes I’m not sure if I should call these posts weeknotes when I see the posting schedule, but oh well. Keep expectations up but also practice forgiveness when not meeting them, it’s fine really. py_modules using hatchling I converted speckenv and django-sitemaps after finding the following very helpful post on packaging projects consisting of Python modules without any packages: Packaging of single Python module projects with Hatch/Hatchling. It’s very easy in hindsight, but that’s basically always the case. The relevant part is including the files in the build: [tool.hatch.build] include = [ "speckenv.py", "speckenv_django.py", "speckenv_django_patch.py", ] That’s all. django-debug-toolbar and tracing the cause of DB queries in an async world I have also started investigating what would have to be changed in django-debug-toolbar to make it fully support async Django. We currently patch Django’s database cursors per thread, which works fine in sync Django land to attribute SQL queries to a particular request/response cycle. Since async Django executes DB queries in a thread pool executor and the rest of the work happens inside awaitables (async land) I don’t immediately see a way how we could do the same thing. It doesn’t seem possible to find out which task spawned another … -
Django News - PyPI token scanning - Aug 18th 2023
News GitHub now scans public issues for PyPI secrets GitHub now detects and revokes exposed PyPI tokens in public repositories. pypi.org pip-tools v7.2.0 it supports -c/--constraint option to sync extra dependencies "Starting from pip-tools v7.2.0 it supports -c/--constraint option so that you can keep in sync your extra dependencies with the main dependencies while using pyproject.toml." Via Albert Tugushev. mastodon.social Python Docs now feature a dark theme! "The #Python docs now have a dark theme! 🌒 " via hugovk mastodon.social Updates to Django This week’s updates is curated by David Smith, Django review and triage team member and django-crispy-forms maintainer. Thank you David! Last week saw 11 pull requests merged into Django by 7 different contributors - including 3 first time contributors! Congratulations to Jingbei Li, Azat and xYazz for having their first commits merged into Django - welcome on board! Contributions last week included addition of the Uyghur (Ug) language where translations will be available from 5.0. The Oracle backend saw the addition of support for the python-oracledb driver and support for the previous cx-oracle module being deprecated. Mariana Pereira who is part of the Djangonaut Space contributor programme had their second PR merged this week to fix ticket … -
Deployment Checklist - Building SaaS #168
In this episode, I added the deployment checklist and improved the security of the app. Then we moved to work to set up the database to use DATABASE_URL and prepare to use Postgres. -
Deployment Checklist - Building SaaS with Python and Django #168
In this episode, I added the deployment checklist and improved the security of the app. Then we moved to work to set up the database to use DATABASE_URL and prepare to use Postgres. -
Contributing to Django - David Smith (Ep97 Replay)
David Smith on Twitterdjango-crispy-formsdjangobenchDiátaxis FrameworkAirspeed Velocity (ASV)DSF Triage & Review TeamVictor Stinner’s Notes on Benchmarking PythonSupport the ShowLearnDjango.comButtonDjango News -
Hire for Floors, not Ceilings
When you’re hiring, try not to get caught in the trap of evaluating candidates based on their best possible performance. Look instead for consistency: reliable results in variable conditions, the ability to deliver predictably with consistent quality, and so forth. -
Composition over inheritance: The case for function-based views
Composition over inheritance: The case for function-based views A recent conversation with Carlton on Mastodon prompted me to write down some of my thoughts re. function- vs class-based views in Django. The early days When I started using Django some time after 0.96 and 1.0 all views were function based. Except when you added a class with a def __call__() method yourself – that was always possible but not really comparable to today’s class-based views. The introduction of class-based views Class based views (both generic versions and the base View) were introduced to Django in 2010. Judging from the ticket tracker the main motivation was to avoid adding yet another argument to the generic function-based views (GFBV) which we’re available in Django back then. The GFBV’s argument count was impressive. Two examples follow: def object_detail(request, queryset, object_id=None, slug=None, slug_field='slug', template_name=None, template_name_field=None, template_loader=loader, extra_context=None, context_processors=None, template_object_name='object', mimetype=None): ... def archive_month(request, year, month, queryset, date_field, month_format='%b', template_name=None, template_loader=loader, extra_context=None, allow_empty=False, context_processors=None, template_object_name='object', mimetype=None, allow_future=False): ... The GFBVs where immediately when GCBVs were introduced and later removed in 2012. Class-based views have to be adapted by calling the View.as_view() method; as_view() returns arguably the thing which is viewed (sorry) as the view by … -
Django News - Python 3.12.0rc1 and Generative Agents oh mai - Aug 11th 2023
News Python 3.12.0 release candidate 1 released Python 3.12.0rc1 is the first release candidate of Python 3.12, with a final version expected on 2023-10-02. Maintainers are urged to ready their projects for 3.12 compatibility, though this preview is not advised for production use. blogspot.com The Python Software Foundation 2022 Annual Impact Report The Python Software Foundation's 2022 Annual Impact Report highlights a year where they welcomed a new Executive Director, reconvened for the first in-person PyCon US since 2019, expanded membership options, awarded $215K in grants, incorporated PyLadies chapters into their fiscal sponsorship program and much more. python.org Python Software Foundation News: Announcing Our New PyPI Safety & Security Engineer! Mike Fiedler joins the PSF as the inaugural PyPI Safety & Security Engineer, boasting 15 years of Python experience and a recent role as a PyPI Maintainer. See from Mike's follow-up post too. blogspot.com Updates to Django Updates to Django This week the updates have been curated by Yemisi, from the Djangonaut Space contributor program. You can find Yemisi on Twitter @Oluwayhemisi1 or LinkedIn Oluwayemisi Ismail. In the previous week, we had 17 pull requests merged into Django by 11 different contributors. Notably, we're thrilled to acknowledge the participation of … -
Practical Business Jinja
Inspired by the Practical Business Python blog this Python Frederick meetup will cover how to automate document creation using Python-docx and Jinja. -
Practical Business Jinja
Inspired by the Practical Business Python blog this Python Frederick meetup will cover how to automate document creation using Python-docx and Jinja. -
Django: The perils of string_if_invalid in templates
Django’s template engine has a string_if_invalid option that replaces missing variable lookups with a string of your choice: TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", # ... "OPTIONS": { # ... "string_if_invalid": "MISSING VARIABLE %s", }, } ] The %s will be replaced with the name of the missing variable. This exists as a debugging aid to track down missing variables, but the documentation comes with a hefty warning: For debug purposes only! While string_if_invalid can be a useful debugging tool, it is a bad idea to turn it on as a 'development default'. Many templates, including some of Django's, rely upon the silence of the template system when a nonexistent variable is encountered. If you assign a value other than '' to string_if_invalid, you will experience rendering problems with these templates and sites. Generally, string_if_invalid should only be enabled in order to debug a specific template problem, then cleared once debugging is complete. (This warning was added in 2006 by Russell Keith-Magee in commit 73a6eb8.) Despite the admonition, there are some recommendations out there to enable the option permanently in tests, including pytest-django’s --fail-on-template-vars option and from myself in a post last year. I’ve recently been exploring ways to prevent … -
Building a Future-Proof Platform with Block-Driven CMS
In a previous blog post, I discussed the advantages of using django CMS to create a Multi-Distribution Channel CMS. To achieve the flexibility required to repurpose content across various channels, it is essential to establish a clear separation between the rendered output (usually HTML) and the underlying data. Django, Django CMS, and django-filer provide the necessary components to construct a customized multi-channel publishing platform tailored to your business needs. Many organizations find themselves outgrowing their page-driven CMS or limited by their current system, prompting them to embark on the challenging path of re-platforming. In this article, I will outline a content architecture that allows for the development of a future-proof platform, capable of evolving as required. This approach is particularly beneficial when managing and displaying complex related data and handling massive data collections to a large audience. Defining the Scenario: ACME Publisher For the purpose of illustration, let’s consider a fictional publisher named ACME, which operates a significant online magazine/newspaper. ACME’s online presence comprises a collection of articles published in various sections. Each article is composed of one or more blocks, such as decorated text, images, slideshows, videos, content promotions, calls to action, and more. ACME, like other publishers, faces … -
Django News - Django bugfix release: 4.2.4 - Aug 4th 2023
News Django bugfix release: 4.2.4 The 4.2.4 bugfix release fixes three different issues. As always, updating to the latest version of Django is highly recommended. djangoproject.com Wagtail 5.1 gets a bit greener and leaner Notes on the latest Wagtail release that focuses on improving performance and reducing Wagtail's carbon footprint. wagtail.org Python Steering Council accepts PEP 703 and plans to remove the GIL The Python Steering Council has informally accepted PEP 703 and outlined their long-term plan to formally drop Python's Global Interpreter Lock (GIL) in a future Python version. python.org Announcing Python Software Foundation Fellow Members for Q1 2023! The PSF is pleased to announce its first batch of PSF Fellows for 2023! blogspot.com Updates to Django From Django Review and Triage Team Member Sarah Boyce. Last week we had 8 pull requests merged into Django by seven different contributors. No first-time contributors this time, so let's celebrate some of our relatively new contributors for coming back! Congratulations to Olivier Tabone for their 2nd, Bruno Alla for their 3rd, and John Parton for their 3rd PR merged into Django! Django 4.2.4 was released earlier this week. While many people are involved in a release, especially the Fellows, I want … -
Launch Preparation - Building SaaS #167
In this episode, I started working through the set of issues that I previously identified as necessary to complete before launching the service on Heroku. We add history tracking, soft deletion for the user model, and integration with SendGrid. -
Launch Preparation - Building SaaS with Python and Django #167
In this episode, I started working through the set of issues that I previously identified as necessary to complete before launching the service on Heroku. We add history tracking, soft deletion for the user model, and integration with SendGrid. -
Boost Your Django DX - Adam Johnson (Ep105 Replay)
Personal websiteBoost Your Django DX - Preorder the New BookMalcolm Tredinnick Memorial PrizeDjango Technical Board Election ResultsFinding the new (and old) contributors to Django 4.0django-upgradedjango-browser-reloadToday’s Django Security Release Deconstructed (4.0.1, 3.2.11, and 2.2.26)SQLite function optimization and PRSignal Receiver Functions tidy up and PROne Line Django Docs Change and PRSupport the ShowLearnDjango.comButtonDjango News newsletter -
Weeknotes (2023 week 30)
Weeknotes Async Django I have used Django Channels successfully in a few projects from 2017 to 2019. A few months back I have worked with Starlette. And now I have finally started digging into using Django itself with an ASGI server, and not just for one or two views but also including the middleware stack etc since I also need authentication, not just an endpoint forwarding requests to a remote server. I have looked at Granian, an RSGI/ASGI server written in Rust. But for now I am using uvicorn. Django truly has come a long way but there’s much left to do. Django 5.0 is looking great already, but 4.2 misses many pieces still. I am really really glad Django wants to stay backwards compatible but I wish I could wave a magic wand and upgrade everything to async. Adding a prefixes everywhere for the async version is certainly a good compromise and probably the way to go but it’s just not that nice. I have been playing around with making feincms3’s applications middleware async compatible because I want the full middleware stack to be async. The code is already released but undocumented and not even mentioned in the changelog. … -
Django News - Django/PyCharm Campaign Extended to July 31st - Jul 28th 2023
News Django + PyCharm Campaign Extended to July 31st You get a 30% discounted year of PyCharm, AND the Django Software Foundation gets 100% of the proceeds. Plus, get one free month of access to JetBrains Academy, which has courses like Intro to Django, SQL, Git, and more! jetbrains.com Updates to Django Updates to Django From Django Review and Triage Team Member Sarah Boyce. Last week we had 16 pull requests merged into Django by 10 different contributors - including 4 first time contributors! Congratulations to Mariana, Nicolò Intrieri, Vyacheslav Dmitriev and Michel Alexandre Salim for having their first commits merged into Django - welcome on board! Now in 5.0, you will notice some color updates to the Django admin light theme. This has improved color contrast to make the admin more accessible #34036. Also, Bhuvnesh has been working on allowing moving a model between apps as part of Google Summer of Code. This is now being tested and so if you have any ideas of scenarios to test, please engage in the discussion on the forum for this feature. For those who are not already familiar with the forum, Django Internals often has discussions involving the current development of …