Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
My (free) Django monitoring stack for 2022
You've built and deployed a website using Django. Congrats! After that initial high of successfully launching your site comes the grubby work of fixing bugs. There are so many things that can will go wrong. Pages may crash with 500 errors in prod, but not locally. Some offline tasks never … -
Django News - Authenticating Users with GraphQL and Django - Dec 30th 2021
Events Python Web Conf 2022 - Early Bird Tickets Available This in-depth Python conference for web developers is on March 21-25, 2022. Early bird tickets are now available. pythonwebconf.com Sponsored Link Error monitoring for Django Developers. Track and debug exceptions in record time so you can get back to doing what you love. honeybadger.io Articles Authenticating users in Graphql with Django session authentication Notes on working with GraphQL and Django session auth. valentinog.com Buying products for your job: estimating value, convincing your boss A thoughtful look at justifying educational and software products for programmers. pythonspeed.com Fixing Memory Leaks In Popular Python Libraries This is not strictly a Django article but it's a very cool, concise look at memory issues in popular Python libraries like Celery. paulsprogrammingnotes.com Set up a Gunicorn Configuration File, and Test It Adam Johnson walks us through configuring Gunicorn and how to test your configuration. adamj.eu You can now use 'pip' to install Tailwind CSS. Node.js is no longer required! Tim Kamanin recently released pytailwindcss, which lets us install and use Tailwind CSS without installing Node.js. timonweb.com Tutorials Celery Groups and Chords A tutorial on using Clery groups and chords to optimize the performance of an app … -
Work Sample Tests: What doesn't work (and why)
I’ve written about a bunch of effective work sample tests and the “rules of the road” that make them effective. One thing I haven’t talked about is counter-examples: types of work sample tests that don’t work. I tend not to do this sort of thing: I find it’s usually more useful to talk about what does work than to pick apart what doesn’t. But here, I think it’s illustrative: looking at why certain kinds of work sample tests fail can help illustrate the principles of effective tests. Let’s look at a few kinds of work sample tests that (usually) fail, and why. -
Set up a Gunicorn Configuration File, and Test It
If you use Gunicorn, it’s likely you have a configuration file. This is a Python module that contains settings as module-level variables. Here’s an example with some essential settings: # Gunicorn configuration file # https://docs.gunicorn.org/en/stable/configure.html#configuration-file # https://docs.gunicorn.org/en/stable/settings.html import multiprocessing max_requests = 1000 max_requests_jitter = 50 log_file = "-" workers = multiprocessing.cpu_count() * 2 + 1 These settings do the following things: max_requests and max_requests_jitter restart workers after so many requests, with some variability. This is a key tool for defending against memory leaks, as I previously discussed. log_file = "-" sets logging to use stdout. This makes gunicorn follow the 12 factor log recommendation. workers = ... configures Gunicorn to run 2N+1 workers, where N is the number of CPU cores on the current machine. This is the recommendation in the docs. Annoyingly, it’s not the default, which is instead only a single process! (I wonder just how many Django apps out there feel “slow” because of this…) There are many more settings available. When you’ve set up a config file you can test it with gunicorn --check-config: $ gunicorn --check-config --config python:example.gunicorn example.wsgi Here: --config defines the config file to check. Using the python: prefix allows us to use … -
import attrs
An attempt at catharsis. -
You can now use 'pip' to install Tailwind CSS. Node.js is no longer required!
I recently released pytailwindcss, a Python package that lets you install the Tailwind CSS executable via pip with just one command: pip install pytailwindcss After the installation is complete, use the terminal to run the tailwindcss command: tailwindcss Behind the scenes, it runs a recently released Tailwind CSS standalone … Read now -
Work Sample Tests: Labs & Simulation Environments
The work sample tests I’ve covered in this series so far all involve software development. But what about roles that don’t involve day-to-day coding: roles like security analysis, penetration testing, technical support, bug bounty triage, project or program management, systems administration, technical operations, and so on? For those roles, I turn to simulated, “lab”-style environments. Here are some examples of that kind of test. -
Django News - Malcolm Tredinnick Memorial Prize Awarded - Dec 23rd 2021
News 2021 Malcolm Tredinnick Memorial Prize awarded to Adam Johnson Congratulations to Adam Johnson, the well-deserved winner of this year's Malcolm Tredinnick Memorial Prize. djangoproject.com Wagtail statement on Log4j vulnerability Wagtail itself isn’t vulnerable, but we encourage users of Elasticsearch to consider updating to the latest version of Elasticsearch. wagtail.io Preorder My New Book: Boost Your Django DX Adam Johnson has a new book coming out next month that is currently available for pre-order at a discount. adamj.eu Sponsored Link Error monitoring for Django Developers. Track and debug exceptions in record time so you can get back to doing what you love. honeybadger.io Articles ‘Reverse’ Code Review Part of a series from Jacob Kaplan-Moss on work sample tests. jacobian.org Introducing django-browser-reload: Automatically Reload Your Browser in Development adamj.eu Optimizing Performance with a Read-Replica Database Adding a read-replica database to a Postgres database on AWS Aurora cluster. kogan.com Tutorials Build an NFT rarity tool with Django Learn how to build an NFT rarity tool with Django, celery for asynchronous tasks, and web3.py to interact with the Ethereum blockchain. justdjango.com Sponsored Jobs Sr. Python Developers — APPLY NOW Want to make an IMPACT? Join our global team of experts, and improve our … -
Customer UX Feature - Building SaaS with Python and Django #122
In this episode, I added some user experience (UX) polish to my Django app to fill in a gap where users couldn’t quickly jump to their proper school year when their homeschool is between school years. We cleaned up the view, modified a template, and wrote the test to prove that the change works. -
Customer UX Feature - Building SaaS #122
In this episode, I added some user experience (UX) polish to my Django app to fill in a gap where users couldn’t quickly jump to their proper school year when their homeschool is between school years. We cleaned up the view, modified a template, and wrote the test to prove that the change works. -
Volunteer Responsibility Amnesty Day
Tomorrow is Volunteer Responsibility Amnesty Day, a day to reflect on your responsibilities as a volunteer and, if any of them are too burdensome, set them down. I’m observing it this year; here’s how and why. -
Authenticating users in Graphql with Django session authentication
We know that in JavaScript, cookies can travel over AJAX requests as long as the request comes from the same origin, and goes to the same origin. In other words, an AJAX request from https://www.pluto.com/ to https://www.pluto.com/api/ carries any cookie currently set in the browser, by sending them in a Cookie header. What this means in a Django project for example is that if a user is authenticated, and a template happens to make an AJAX request to the same backend, authentication credentials are transmitted by default. In Django, the authentication cookie stored in the browser is called sessionid by default. In fact, by examining the headers of a WSGIRequest or ASGIRequest for an authenticated user in Django, we should be able to see something along these lines: { 'Cookie': 'sessionid=g9eflhxbeih1lgmslnybt5dn21zgk28t'; csrftoken=D3DtmfPKxriKMoy70eYikf8pUEVMTy3bDTczk8Ni0BNFVArAWg9oGat5V8PfKQW1 } Such a request means that the user issuing the request is indeed authenticated. Here's the crazy idea: if you use GraphQL under Django session auth umbrella, you can use validate the sessionid cookie in the resolver itself. Here's how. Validating sessionid in a GraphQL resolver Consider the following Ariadne GraphQL resolver: @mutation.field("replyUpdate") def reply_update(_obj: Any, info: GraphQLResolveInfo, reply): """Resolver for reply update.""" request: ASGIRequest = info.context["request"] # … -
My site's now NextJS - And I (almost) regret it already
My personal blog was a regular Django website with jQuery (later switched to Cash) for dynamic bits. In December 2021 I rewrote it in NextJS. It was a fun journey and NextJS is great but it's really not without some regrets. Some flashpoints for note and comparison: React SSR is awesome The way infinitely nested comments are rendered is isomorphic now. Before I had to code it once as a Jinja2 template thing and once as a Cash (a fork of jQuery) thing. That's the nice and the promise of JavaScript React and server-side rendering. JS bloat The total JS payload is now ~111KB in 16 files. It used to be ~36KB in 7 files. :( Before After Data still comes from Django Like any website, the web pages are made up from A) getting the raw data from a database, B) rendering that data in HTML. I didn't want to rewrite all the database queries in Node (inside getServerSideProps). What I did was I moved all the data gathering Django code and put them under a /api/v1/ prefix publishing simple JSON blobs. Then this is exposed on 127.0.0.1:3000 which the Node server fetches. And I wired up that that … -
My site's now NextJS - And I (almost) regret it already
My personal blog was a regular Django website with jQuery (later switched to Cash) for dynamic bits. In December 2021 I rewrote it in NextJS. It was a fun journey and NextJS is great but it's really not without some regrets. Some flashpoints for note and comparison: React SSR is awesome The way infinitely nested comments are rendered is isomorphic now. Before I had to code it once as a Jinja2 template thing and once as a Cash (a fork of jQuery) thing. That's the nice and the promise of JavaScript React and server-side rendering. JS bloat The total JS payload is now ~111KB in 16 files. It used to be ~36KB in 7 files. :( Before After Data still comes from Django Like any website, the web pages are made up from A) getting the raw data from a database, B) rendering that data in HTML. I didn't want to rewrite all the database queries in Node (inside getServerSideProps). What I did was I moved all the data gathering Django code and put them under a /api/v1/ prefix publishing simple JSON blobs. Then this is exposed on 127.0.0.1:3000 which the Node server fetches. And I wired up that that … -
Django News - Django REST Framework 3.13 released! - Dec 17th 2021
News Django REST Framework 3.13 released The newest major release of Django REST Framework is out! It includes Django 4.0 compatibility and a host of new features. django-rest-framework.org Python Software Foundation News: PyPI User Feedback Summary The PSF conducted a series of three surveys to identify key user requirements that have not been addressed so far. This post summarizes the feedback received and decisions made as a result. blogspot.com Standalone CLI: Use Tailwind CSS without Node.js Tailwind CSS CLI gives you the full power of Tailwind ÇSS in a self-contained executable without no Node.js or npm required. tailwindcss.com Sponsored Link Error monitoring for Django Developers. Track and debug exceptions in record time so you can get back to doing what you love. honeybadger.io Articles Anti-Patterns When Building Container Images A list of recurring Docker anti-patterns and suggestions to avoid them or refactor them into something better. github.io The definitive guide to modeling polymorphism in Django Polymorphism allows you to use one type of object to work with multiple kinds of data. There are multiple ways to model polymorphism in Django as demonstrated in this article. confuzeus.com Why you should check-in your node dependencies by Jack Franklin From a member of … -
Introducing django-browser-reload: Automatically Reload Your Browser in Development
Hitting “refresh” to see your changes is an instinct many web developers develop. But it’s a small waste of time that adds up to many hours per year spent waiting. It’s a sub-optimal development experience (DX). Django’s development server reloads itself when you change code, but it does not tell the browser to reload. And it does not do anything when a template or static asset changes. Framework-Agnostic Tools There various framework-agnostic tools out there to address these shortcomings, but I’ve often found they have shortcomings. For a start, they’re an extra thing to install, normally in a different language, requiring e.g. Node.js to be set up. And they normally wrap the server, so you have to run both the tool and Django’s runserver. Perhaps the biggest potential drawback of such reloaders is that they watch project files a second time, whilst Django is already watching them. This can take a lot of CPU if done without OS-specific API’s (Django can do that with Watchman, which you should definitely set up). django-browser-reload Whilst I’m working on my upcoming Django DX book, I have thought about this problem on-and-off. I came up with an idea for a browser reloader that could … -
Listen Notes - Wenbin Fant (Ep 41 Replay)
Weekly DjangoChat NewsletterListen NotesThe Boring Tech Behind a One-Person Internet CompanySearch From the Ground Up @DjangoCon US 2019Django Search Tutorial -
Work Sample Tests: ‘Reverse’ Code Review
For most software engineering roles, the best work sample test will be some combination of the exercises I covered earlier in this series. But not every role; there are some circumstances where other types of tests fit better or are better at revealing some critical piece of information relevant to hiring. This post covers one of them: a “reverse” code review, where instead of you reviewing the candidate’s code, you have them review yours. -
Serving a Machine Learning Model with FastAPI and Streamlit
This tutorial looks at how to serve up a style transfer machine learning model with FastAPI and Streamlit. -
Django News - Django 4.0 Released! - Dec 10th 2021
News Django 4.0 released Django 4.0 has been released! It features built-in Redis support, form rendering using the template engine, and many more features available on the release notes. djangoproject.com Django security releases issued: 3.2.10, 3.1.14, and 2.2.25 This release fixes a security issue around potential bypass of an upstream access control based on URL paths. As ever, updating to the latest version of Django is always highly recommended. djangoproject.com Python 3.10.1 is available Python 3.10.1 is the newest major release of the Python programming language, and it contains many new features and optimizations. blogspot.com A message from the PSF's outgoing Executive Director A note from Ewa Jodlowska, who has been part of the Python community for over a decade. blogspot.com 2022 DSF Board Election Results The voting results are released for the 2022 Django Software Foundation Board. It was great to see so many candidates since the DSF simply isn't possible without the help of all of our volunteers. djangoproject.com Tailwind CSS v3.0 For a tour of some of the new features, check out the “What’s new in Tailwind CSS v3.0” video. Check out the v2 to v3 upgrade guide. tailwindcss.com Events Free coding lessons for Django Girls alumni … -
Django-Tailwind with support for the latest Tailwind CSS v3 is out
Yesterday, as I was about to go to bed, I found out that Tailwind CSS 3.0 had been released. Knowing that a lot of Django people adore Tailwind CSS so much, I decided I couldn't sleep until I upgraded Django-Tailwind to support the latest version of the library. Long story … Read now -
Threat Modeling Jurassic Park with Python
How would John Hammond design the systems on Isla Nublar in 2021? Would he spare no expense to reduce risk of a disaster? We hope that his software engineers would employ the concept of threat modeling, one of the most important security skills in modern software development. Corey will give an overview of what threat modeling is, and how to use it to highlight security concerns early on in the SDLC. -
Threat Modeling Jurassic Park with Python
How would John Hammond design the systems on Isla Nublar in 2021? Would he spare no expense to reduce risk of a disaster? We hope that his software engineers would employ the concept of threat modeling, one of the most important security skills in modern software development. Corey will give an overview of what threat modeling is, and how to use it to highlight security concerns early on in the SDLC. -
Django Stubs - Nikita Sobolev
Personal websitedjango-stubsmypysans-ioreturnsWhat Color is Your Function?DryLabsWe Make ServicesHow Async Should Have BeenSupport the ShowThis podcast does not have any ads or sponsors. To support the show, please consider visiting LearnDjango.com, Button, or Django News. -
Preorder My New Book: Boost Your Django DX
Developer Experience (DX) is a catch-all term for anything that can improve your development workflow. Such improvements can help you write better code, faster, with fewer bugs. During my years working with Django, I’ve picked up many tools and techniques to boost my “DX”. My upcoming book Boost Your Django DX covers as many of these as possible, so you can learn them too! The book is inspired by the Japanese concept of kaizen: constant improvement to a process. As such, it teaches you how to use these tools, extend them, and even how to write your own. This way you can constantly revise your development process. Content The book contains the following chapters: Origin Opening notes, a description of the included examples. Documentation Tools to get you to the right documentation, quicker. Covers DevDocs, DuckDuckGo, Bonus Django Documentation Sites, Wget, and some miscellaneous tips. Virtual Environments and Dependencies Manage environments, and the dependencies within, correctly and easily. Covers venv, virtualenv, pip-tools, pip-lock, recommended practices for dependency management, and Python’s development mode. Python Shell Enhance your Python command line experience. Covers IPython and django-read-only. Development Server Make Django’s runserver better. Covers Watchman, django-debug-toolbar, and Rich. Code Quality Tools The key …