Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django News - 🎂 Django News Newsletter turns one-year-old! - Dec 4th 2020
Introduction Django News Newsletter feedback This newsletter turns one year old this week. We (Jeff & Will) would like feedback on what you like and what could be improved for year #2. Please take a moment to respond on either the Django Forum or the Google Form. djangoproject.com News Django bugfix release: 3.1.4 The 🥧 release is out with 7 different bugfixes. djangoproject.com Pip 20.3 Release (heads-up for potential disruption) The pip we have been warning you about for six months is out and you will more than likely run into a few issues. python.org Help share the future of Django Girls Django Girls is looking for advisory board members for 2021. djangogirls.org Rebuilding the PSF - Q4 2020 Fundraiser The Python Software Foundation is running its Q4 fundraiser and is raising money to offset any potential 2021 revenue shortfalls. python.org Events Announcing PyCon US 2021 PyCon US goes virtual again for 2021. blogspot.com Articles Don't Panic: Kubernetes and Docker tl;dr Docker will still run in your Kubernetes cluster. kubernetes.io Django Best Practices: Referencing the User Model There are 3 different ways to access the built-in User model. This post covers each method with recommendations on the best approach. learndjango.com … -
Finishing Onboarding - Building SaaS #81
In this episode, I completed the last form that completes the last step on my Django app’s onboarding process. We built up the view, wrote the tests, and worked through the templates changes. I started with a discussion of what the onboarding flow does and what was left. I needed to make a form that creates a task for a course. For the first chunk of code, we added some tests to cover all the scenarios that are important for the view. -
Django: Change or translate the app name in the admin menu
Let’s say I have a Django app users. The admin menu shows this as category Users. That’s ok, but if the website users speak another language I want this name translated. Also I’m not necessarily using Users as name in the admin menu as section name, but can use something more descriptive. Website Users, as example. -
Finding Performance Issues In Python Web Apps with Sentry
Introduction Earlier, we have seen couple of articles here on finding performance issues1 and how to go about optimizing them2. In this article, lets see how to use Sentry Performance to find bottlenecks in Python web applications. The Pitfalls A common pitfall while identifying performance issues is to do profiling in development environment. Performance in development environment will be quite different from production environment due to difference in system requirements, database size, network latency etc. In some cases, performance issues could be happening only for certain users and in specific scenarios. Replicating production performance on development machine will be costly. To avoid these, we can use APM tool to monitor performance in production. Sentry Performance Sentry is widely used Open source error tracking tool. Recently, it has introduced Performance to track performance also. Sentry doesn't need any agent running on the host machine to track performance. Enabling performance monitoring is just a single line change in Sentry3 setup. import sentry_sdk sentry_sdk.init( dsn="dummy_dsn", # Trace half the requests traces_sample_rate=0.5, ) Tracing performance will have additional overhead4 on the web application response time. Depending on the traffic, server capacity, acceptable overhead, we can decide what percentage of the requests we need to … -
Exhaustiveness Checking with Mypy
Mypy is an optional static type checker for Python. It's been around since 2012 and is gaining traction even since. One of the main benefits of using a type checker is getting errors at "compile time" rather than at run time. Exhaustiveness checking is a common feature of type checkers, and a very useful one! In this article I'm going to show you how you can get mypy to perform exhaustiveness checking! Playing cards are also useful for explaining enumeration types...Photo by Daniel Rykhev Table of Contents Exhaustiveness Checking Enumeration types Type Narrowing in Mypy The Future Bonus: Exhaustiveness Checking in Django Exhaustiveness Checking Say you have a system to manage orders. To represent the status of an order, you have the following enum: import enum class OrderStatus(enum.Enum): Ready = 'ready' Shipped = 'shipped' You also have the following code to process an Order: def handle_order(status: OrderStatus) -> None: if status is OrderStatus.Ready: print('ship order') elif status is OrderStatus.Shipped: print('charge order') When the order is ready, you ship it; and when it's shipped, you charge it. A few months go by and your system becomes big. So big in fact, that you can no longer ship orders immediately, and you … -
How to create a celery task that fills out fields using Django
Hi everyone! It’s been way too long, I know. In this oportunity, I wanted to talk about asynchronicity in Django, but first, lets set up the stage: Imagine you are working in a library and you have to develop an app that allows users to register new books using a barcode scanner. The system has to read the ISBN code and use an external resource to fill in the information (title, pages, authors, etc.). You don’t need the complete book information to continue, so the external resource can’t hold the request. How can you process the external request asynchronously? 🤔 For that, we need Celery. What is Celery? Celery is a “distributed task queue”. Fron their website: > Celery is a simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. So Celery can get messages from external processes via a broker (like Redis), and process them. The best thing is: Django can connect to Celery very easily, and Celery can access Django models without any problem. Sweet! Lets code! Let’s assume our project structure is the following: - app/ - manage.py - app/ - __init__.py … -
How to create a celery task that fills out fields using Django
Hi everyone! It’s been way too long, I know. In this oportunity, I wanted to talk about asynchronicity in Django, but first, lets set up the stage: Imagine you are working in a library and you have to develop an app that allows users to register new books using a barcode scanner. The system has to read the ISBN code and use an external resource to fill in the information (title, pages, authors, etc. -
Django: Remove default entries from admin menu
The Django administration site comes with a couple of default entries, depending on which apps and middleware is installed. -
How To Use Linode's Object Storage For Staticfiles
Recently Linode has released an alternative to AWS's S3 object storage service, called Object Storage. It uses a similar S3 architecture to AWS's offering, albeit with a much more simplified ... -
Cyber Monday discount for Speed Up Your Django Tests
Earlier this week I tweeted about my two part offer on my book Speed Up Your Django Tests for this year’s Cyber Monday. Firstly, I’m offering a 50% discount on the book during the day. This will last whilst it’s the 30th November “Anywhere on Earth” (AoE), so as long as there’s one time zone where it’s Monday the 30th November, you can get that discount. The deal will stack with the regional discount that offers a 50% discount for those living outside the GDP top 50. If you live in such a country, email me to get a total of 75% off the list price. Secondly, to promote the deal, I’m giving away a free copy of the book to someone who retweets that tweet. I’ll do the draw at 09:00 UTC on Monday and announce it in the comments on Twitter. Buy it on Gumroad! If you’re looking for other deals on Python and Django learning materials, check out Trey Hunner’s post that compiles many offers available. I’m a subcriber to his Python Morsels and can attest to their quality for teaching you the breadth of features in Python. -
Django News - Final week of DSF Nominations - Nov 27th 2020
News 2021 DSF Board Nominations Nominations are open until November 30th for next year's Django Software Foundation board. djangoproject.com Events Pyjamas 2020 - December 5th, 2020 24 hours streaming of talks about Python and connecting with Python communities around the world that you can access at home. pyjamas.live Articles Migrating to a Custom User Model mid-project in Django A nice summary of the steps needed to migrate to a custom user model mid-project. rasulkireev.com The trouble with transaction.atomic by David Seddon Does Django's transaction.atomic trip you up? Us too. seddonym.me Django Best Practices: Models How to properly define and structure your Django models. learndjango.com Unravelling `not` in Python Brett Cannon deep dives into how the not operator works in Python. snarky.ca Django: Testing for Missing Migrations A short pytest test for missing migrations. Probably useful in every Django project. birdhouse.org Evolution of a Django Repository pattern An 18-step walkthrough of a sample Django repository. lukeplant.me.uk PostgreSQL Benchmarks: Apple ARM M1 MacBook Pro 2020 If you are curious how PostgreSQL performs on Apple Silicon chips then here you go. crunchydata.com The hidden Django anti-pattern preventing your prod rollback Hopefully, you won't need to rollback your migrations in production, but if you … -
Episode 10 - User Auth
On this episode, we’re going to look at working with users in a Django project. We’ll see Django’s tools for identifying users and checking what those users are permitted to do on your website. Listen at djangoriffs.com. Last Episode On the last episode, I explained the structure of Django application. We also talked why this structure is significant and how Django apps benefit the Django ecosystem as a tool for sharing code. -
User Auth
Full show notes are available at https://www.mattlayman.com/django-riffs/10. -
Django: disable inline option to add new referenced objects
The Django Web Framework makes it quite easy to add new referenced objects in the admin menu. -
Django Software Foundation - 2021 Board Nominations
2021 DSF Board NominationsDjango Software FoundationDSF Individual MembersDjango Forum: Additional DSF Funding UsesDSF Board Meeting Minutes 2020Support the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, consider purchasing or recommending a book from LearnDjango.com or signing up for the free weekly Django News newsletter. -
Django News - DSF 2021 Board Nominations - Nov 20th 2020
News 2021 Django Software Foundation Board Nominations Nominations for the 2021 DSF Board of Directors is now open. This is an excellent opportunity to help advance Django. We can’t do it without volunteers, such as yourself. For the most part, the time commitment is a few hours per month. Anyone including current Board members, DSF Members, or the public at large can apply to the Board. It is open to all who wish to participate. djangoproject.com Additional DSF Funding Uses A thread on the Django Forum about potential ways the Django Software Foundation could expand in coming years. djangoproject.com Wagtail 2.11.2 Released Wagtail 2.11.2 adds a half-dozen fixes and adds a few new features. github.com Tailwind CSS v2.0 – Tailwind CSS This is a major upgrade to Tailwind CSS, a popular CSS library commonly used in Django projects. tailwindcss.com Read the Docs Blog: Announcing Chan Zuckerberg Initiative Grant to Expand the Interoperability of Scientific Documentation Read the Docs received a grant from the Chan Zuckerberg Initiative’s Essential Open Source for Science (EOSS) program. Find out more about their plans. readthedocs.com Articles Django Best Practices: User Permissions An overview of three different ways to set user permissions with recommendations on when … -
Reordering Models - Building SaaS #80
In this episode, we looked at an UpdateView for the GradeLevel model in the homeschool application. Along the way, I had to display some UI elements on the grade to give users the ability to adjust the ordering of courses within their grade level. We started by adding the icon link that I wanted to use to give users access to the edit page. Once the link was in place, I created the URL and copied an existing view as a starting point for the UpdateView. -
Migrating to a Custom User Model mid-project in Django
Whenever you building a site with Django that will have user authentication, it is recommended to create a Custom User Model, before the first migration. Sometimes you forget to do that. In this case you have to follow a strict procedure, which I'll show you in the post. -
Make A Hugo Static Blog Inside A Django App
I have a side project and I’d like to do some content marketing to potential customers to show how my product is useful. To do this, I need a blog for my project. Maybe you need a blog for your project too. Have you thought about where your blog will exist on the internet? For me, I considered two choices: Use a subdomain like blog.mysite.com. Use a route style like mysite. -
Evennia 0.9.5 released!
As of today, Evennia 0.9.5 is out. Evennia is a Python based library and framework for creating text-based multiplayer games (MUD/MU*). This is a gradual improvement halfway between 0.9 and the upcoming 1.0. So if you have been keeping up-to-date with the master branch of Evennia over the last year you will not notice much difference from this release (time to upgrade if you haven't been keeping up though!). While an interim release, there are still a lot of things that has happened since v0.9: Webclient improvements Big web client improvements (courtesy of contributor friarzen) - players can now save and restore pane layouts directly in the client (so you could have a separate pane for channel chatter, another for look-returns, two input panes etc etc). The layout changes makes it easier for devs to create default layouts to offer to players of their game. People in the Evennia community have already started doing very cool stuff with this, I'll try to gather screenshots for a future blog. Allow to redirect video/music to separate panes.Many other fixes, such as improving the input-history behavior. EvMenu improvementsEvMenu is a powerful system for creating in-game text menus.The EvMenu class was refactored to be easier to override. For … -
Django News - Malcolm Tredinnick Nominations - Nov 13th 2020
News Nominations for 2020 Malcolm Tredinnick Memorial Prize The Malcolm Tredinnick Memorial Prize is a monetary prize, awarded annually, to the person who best exemplifies the spirit of Malcolm’s work - someone who welcomes, supports and nurtures newcomers; freely gives feedback and assistance to others, and helps to grow the community. The hope is that the recipient of the award will use the award stipend as a contribution to travel to a community event -- a DjangoCon, a PyCon, a sprint -- and continue in Malcolm’s footsteps. djangoproject.com Sponsor @python on GitHub Sponsors You can now sponsor the Python Software Foundation on GitHub Sponsors. github.com GitHub Actions: Removing set-env and add-path commands on November 16 This is a security PSA for anyone who uses GitHub Actions for their CI and the set-env or add-path commands. They will stop working on November 16. github.blog Events Seattle GNU/Linux Conference SeaGL is free and November 13th and 14th. seagl.org Articles Hunting for Malicious Packages on PyPI Jordan Wright deep dives into how to detect a malicious PyPI package. jordan-wright.com Managing a Django Project with Poetry A quick guide to configuring Poetry, a Python dependency manager, in a Django project. rasulkireev.com Django Best Practices: … -
WhiteNoise Shenanigans - Building SaaS #79
In this episode, I worked on a method of adding static content to a site that didn’t involve the staticfiles directory, a separate domain, or a reverse proxy like Nginx. We had to get clever with Heroku buildpacks and how to configure WhiteNoise. I want to put a blog on my side project for content marketing purposes. I want the blog to be statically generated and have content come from Markdown (just like these show notes that you’re currently reading). -
Django @Instagram - Carl Meyer
OddBirdDjango @ Instagram - Django Under the Hood 2016Testing & Django - PyCon 2012PyCon 2017 Keynote - Road to Python 3 at InstagramPython at Scale: Strict ModulesSupport the ShowOur podcast does not have a sponsor and is a labor of love. To support the show, please consider purchasing one of the books on LearnDjango.com or suggest one to a friend. -
Django Best Practices: Projects vs Apps
Django's definition of an "app" is often confusing to newcomers. In this post we'll examine the four major concepts of Django architecture by building out a basic blog web application. … -
Django Sitemap Tutorial
A vital part of modern SEO (Search Engine Optimization) is to have a sitemap, an XML file that tells a search engine how often a page is updated and how …