Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
How to Get Hired as a Django Developer
Hiring developers is a famously non-linear problem. Once you have a job at a notable company, it seems recruiters constantly beat down your door. But how do you get started? … -
NameError: name 'os' is not defined
If you've started a new Django 3.1+ project and are using older tutorials or guides, it's likely to come across the following error on your command line: ``` NameError: name … -
Django Polls Tutorial API
The [polls tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/) is the official guide to Django. As a fun exercise, I wanted to show how little code it takes to transform it into a robust API using … -
Flask vs Django (2022)
[Flask](https://palletsprojects.com/p/flask/) and [Django](https://www.djangoproject.com) are the two most popular [Python-based](https://www.python.org) web frameworks. Both are mature, open-source, and have many happy users. A natural question therefore is: which one to use? In … -
Colossal Coaster and Stripe CSP - Building SaaS with Python and Django #152
In this episode, we did an Exercism excercise that looked at Python list methods. Then we dug into Stripe and got to the bottom of some warnings reported by Firefox about potential Content Security Policy issues. Ultimately, we discovered some interesting additional Firefox cookie protection that were not found in Chrome. -
Colossal Coaster and Stripe CSP - Building SaaS #152
In this episode, we did an Exercism excercise that looked at Python list methods. Then we dug into Stripe and got to the bottom of some warnings reported by Firefox about potential Content Security Policy issues. Ultimately, we discovered some interesting additional Firefox cookie protection that were not found in Chrome. -
Postgres - Craig Kerstiens
Craig's Personal websiteCrunchy DataUnfinished Business with PostgresCrunchy Bridge's Ruby Backend: Sorbet, Tapioca, and Parlour-Generated Type StubsPostgres PlaygroundPostgres WeeklySupport 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. -
How much faster is Cheerio at parsing depending on xmlMode?
Cheerio is a fantastic Node library for parsing HTML and then being able to manipulate and serialize it. But you can also just use it for parsing HTML and plucking out what you need. We use that to prepare the text that goes into our search index for our site. It basically works like this: const body = await getBody('http://localhost:4002' + eachPage.path) const $ = cheerio.load(body) const title = $('h1').text() const intro = $('p.intro').text() ... But it hit me, can we speed that up? cheerio actually ships with two different parsers: parse5 htmlparser2 One is faster and one is more strict. But I wanted to see this in a real-world example. So I made two runs where I used: const $ = cheerio.load(body) in one run, and: const $ = cheerio.load(body, { xmlMode: true }) in another. After having parsed 1,635 pages of HTML of various sizes the results are: FILE: load.txt MEAN: 13.19457640586797 MEDIAN: 10.5975 FILE: load-xmlmode.txt MEAN: 3.9020372860635697 MEDIAN: 3.1020000000000003 So, using {xmlMode:true} leads to roughly a 3x speedup. I think it pretty much confirms the original benchmark, but now I know based on a real application. -
Django News - 2022 Malcolm Tredinnick Memorial Prize awarded to Paolo Melchiorre - Dec 2nd 2022
News 2022 Malcolm Tredinnick Memorial Prize awarded to Paolo Melchiorre The Django Software Foundation Board is pleased to announce that the 2022 Malcolm Tredinnick Memorial Prize has been awarded to Paolo Melchiorre. Check out Paolo's blog post too. djangoproject.com 2023 DSF Board Election Results There were 30 candidates this year and the election results are in for next year. djangoproject.com Sponsored Ad Django Hosting by CodeRed Cloud At CodeRed, we’re striving to build the world’s easiest Django hosting platform. Go from polls tutorial to production in just a few minutes. Get started with a free account which includes a MariaDB or Postgres database, static + media hosting, and everything you need to run a Django site. No AWS, S3, Docker, or 3rd-party services required! codered.cloud Articles Test factory functions in Django A very well done guide to test factory functions in Django, why to use them, custom factory functions, what not to do, and more. lukeplant.me.uk Django Settings Patterns to Avoid Sage advice from Adam Johonson on some potential mistakes made with Django settings that you can avoid. adamj.eu The Essential Django Deployment Guide A comprehensive overview of what it takes to get your Django app into production and the … -
Learn Python By Example - Ghost Gobble Arcade Game
Learn Python By Example shows a simple Python exercise from Exercism. This problem illustrates booleans in Python. -
Learn Python By Example - Ghost Gobble Arcade Game
Learn Python By Example shows a simple Python exercise from Exercism. This problem illustrates booleans in Python. -
Blackjack and Bugs - Building SaaS with Python and Django #151
In this episode, we started with a Python exercise on Exercism that explored Blackjack. We wrote functions that handled some of Blackjack’s core rules. After the Python exercise, we focused on a bug in the Django app that fixed an edge case with some the teacher checklist feature. -
Blackjack and Bugs - Building SaaS #151
In this episode, we started with a Python exercise on Exercism that explored Blackjack. We wrote functions that handled some of Blackjack’s core rules. After the Python exercise, we focused on a bug in the Django app that fixed an edge case with some the teacher checklist feature. -
Programmatically control the matrix in a GitHub Action workflow
If you've used GitHub Actions before you might be familiar with the matrix strategy. For example: name: My workflow jobs: build: strategy: matrix: version: [10, 12, 14, 16, 18] steps: - name: Set up Node ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} ... But what if you want that list of things in the matrix to be variable? For example, on rainy days you want it to be [10, 12, 14] and on sunny days you want it to be [14, 16, 18]. Or, more seriously, what if you want it to depend on how the workflow is started? Let's explain this with a scoped example You can make a workflow run on a schedule, on pull requests, on pushes, on manual "Run workflow", or as a result on some other workflow finishing. First, let's set up some sample on directives: name: My workflow on: workflow_dispatch: schedule: - cron: '*/5 * * * *' workflow_run: workflows: ['Build and Deploy stuff'] types: - completed The workflow_dispatch makes it so that a button like this appears: The schedule, in this example, means "At every 5th minute" And workflow_run, in this example, means that it waits for another workflow, in … -
Handy tool: pyupgrade
An advantage of open source is that, ideally, you get to work with other programmers from different companies and different backgrounds and different toolchains. They do things differently and so you can pick out the choice bits and start using them yourself. As an example, z3c.dependencychecker. A small tool I started in 2009 based on someone else's script. The goal is to look at all the imports in your python code (or apps in django settings files or...) and compare them to the list of requirements in setup.py. What's missing? What can be removed? The last few weeks, gforcada did some nice modernization/cleanup. Removing support for older python versions, for instance. And a move from travis-ci to github actions. So I looked at the new action workflow and saw something new. Black, isort, flake8: I know and use them. But pyupgrade? What is that? That's how I discovered pyupgrade. Handy tool to upgrade your code to newer python versions. By default, it removes python 2.x stuff that is no longer needed, like # -*- coding: utf-8 -*- at the top of your file. super() calls no longer need to mention the super class. The is not that flake8 tells you … -
Deserializing Django objects and many to many relationships
I recently had to restore some data from backups, and was using Django serializers to get the job done. Objects of one class were not deleted, but the relationships were set to None when the related objects were deleted. Here's how I restored the relationship information. -
Learn Python By Example - Currency Exchange
Learn Python By Example shows a simple Python exercise from Exercism. This problem illustrates numbers in Python and how to use the built-in math operators. Since this is the first video in this series, I also take a bit of time to show how to use Exercism along the way in case you would like to learn using Exercism as well. -
Learn Python By Example - Currency Exchange
Learn Python By Example shows a simple Python exercise from Exercism. This problem illustrates numbers in Python and how to use the built-in math operators. Since this is the first video in this series, I also take a bit of time to show how to use Exercism along the way in case you would like to learn using Exercism as well. -
Django News - Django-related Deals for Black Friday and Cyber Monday 2022 - Nov 25th 2022
News Django-related Deals for Black Friday and Cyber Monday 2022 Eight different Django content creators or having deals right now. Check it out! adamj.eu Join DEFNA! Board Member Recruitment DEFNA (Django Events Foundation North America), not to be confused with the DSF (Django Software Foundation), is looking for another board member. Applications are due December 3rd. defna.org Sponsored Ad Lifetime License of SaaS Pegasus 50% Off This Week Only SaaS Pegasus is a Django boilerplate with built-in teams, billing, a modern front end, instant deployment and more. This week only you can get a lifetime license for Pegasus on unlimited sites for 50% off. See why more than 500 django developers have chosen Pegasus, and launch your next app faster than you dreamed possible. saaspegasus.com Events PyCon US on Twitter: Join the #PyConUS 2023 team by volunteering for our Online Experience Committee! Have some extra time to give? Join the #PyConUS 2023 team by volunteering for our Online Experience Committee! We are looking for helpful humans to help us run the #PyConUS 2023 virtual platform, Hubilo. twitter.com Articles PyDev of the Week: Sarah Abderemane Sarah is very active in Django and has recently been working to add a dark mode … -
2022 Malcolm Tredinnick Memorial Prize
The Django Software Foundation awarded me the 2022 Malcolm Tredinnick Memorial Prize. -
Django Settings Patterns to Avoid
This post is an adapted extract from my book Boost Your Django DX, available now. It has a 50% discount for the Black Friday sale, until the end of Cyber Monday (28th Nov), plus a further 50% off for those outside the GDP top 50. Here are some potential mistakes made with Django settings that you can avoid. Don’t Read Settings at Import Time Python doesn’t make a distinction between import time and run time. As such, it’s possible to read settings at import time, but this can lead to subtle bugs. Reading a setting at import time will use or copy its initial value, and will not account for any later changes. Settings don’t often change, but when they do, you definitely want to use the new value. For example, take this views file: from django.conf import settings ... page_size = settings.PAGE_SIZE def book_list(request): paginator = Paginator(Book.objects.all(), page_size) ... page_size is set to the value of the setting once, at import time. It won’t account for any changes made in tests, such as with override_settings: from django.test import TestCase, override_settings class BookListTests(TestCase): def test_pagination(self): with override_settings(PAGE_SIZE=2): response = self.client.get(...) The previous view code would not use the changed PAGE_SIZE … -
Butter CMS - Jake Lumetta
ButterCMSButterCMS Job Openings@jakelumettaSupport 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-related Deals for Black Friday and Cyber Monday 2022
Here are some Django-related deals for this year’s Black Friday (25th Nov) and Cyber Monday (28th Nov), including my own. My books My two books, Boost Your Django DX and Speed Up Your Django Tests, have 50% off their base prices. The deal stacks 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 base prices. This discount is available until the end of Cyber Monday, “Anywhere on Earth” (AoE). That is, it’s live as long as it’s still Cyber Monday or before, in one time zone, anywhere on earth. Buy now: Boost Your Django DX Speed Up Your Django Tests (You can buy both in one transaction by clicking “Buy this” on one, then “Continue shopping” at the top right, which will let you add the other to your cart.) William Vincent’s Three Book Bundle William Vincent is the author of three fantastic Django books: Django for Beginners Django for APIs Django for Professionals He’s offering a 50% discount on the three book bundle, from $97 to $49. Buy it on Gumroad testdriven.io Four Course … -
Django News - 2023 Django Software Foundation Board Candidates - Nov 18th 2022
News 2023 DSF Board Candidates There are thirty candidates for the upcoming 2023 Django Software Foundation Board, the non-profit behind Django. DSF Individual Members vote on them. djangoproject.com Wagtail 4.1.1 Wagtail 4.1.1 fixes almost a dozen bugs. github.com Django Technical Board: Project Ideas, and beginning GSoC 2023. The 2023 Google Summer of Code has been announced and Django Fellow Carlton Gibson is soliciting input on project ideas. google.com Python 3.12.0 alpha 2 released Python 3.12.0a2 is the second of seven planned alpha releases. python.org Acceptable Use Policy · PyPI The Python Package Index (PyPI) added an Acceptable Use Policy. pypi.org Sponsored Ad Now Hiring Software Engineers Are you interested in building the next generation MLOPS Platform in Django? Apply today! Ampsight, Inc. is a small but quickly growing government services technology company located in Ashburn, Virginia, recently recognized by Inc. 5000 as one of the fastest growing companies in the United States. trinethire.com Articles Contributing to Django or how I learned to stop worrying and just try to fix an ORM Bug From attending the DjangoCon US sprints to tackling an ORM bug, Ryan Cheley walks us through the entire process. ryancheley.com Towards Inbox Zero: An update on Django's open … -
Development Cached Templates - Building SaaS with Python and Django #150
In this episode, I ran through a Python exercise on Exercism that focused on strings. Then we moved onto the homeschool app and fixed an issue with templates that were cached during development because of changes in Django 4.1.