Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Command Line for Beginners
The _command line_ is a powerful text-only interface for computers. If you have ever seen a show where hackers are furiously typing into a black window, that's the command line. … -
Trailing URL Slashes in Django
Among Django's many built-in features is [APPEND_SLASH](https://docs.djangoproject.com/en/4.0/ref/settings/#append-slash), which by default is set to `True` and automatically appends a slash `/` to URLs that would otherwise [404](https://en.wikipedia.org/wiki/HTTP_404). **Note**: The Chrome web … -
What is Django (Python)?
[Django](https://djangoproject.com) is an open-source web framework written in the [Python](https://www.python.org) programming language. Named after the jazz guitarist [Django Reinhardt](https://en.wikipedia.org/wiki/Django_Reinhardt), it is used by some of the largest websites in the … -
What's New in Django 3.1
Django 3.1 will be released in early August 2020 and comes a number of major new features and many minor improvements including asychnronous views and middleware support, asynchronous tests, JSONField … -
Django Best Practices: Custom User Model
Django ships with a built-in [User model](https://docs.djangoproject.com/en/4.0/ref/contrib/auth/#django.contrib.auth.models.User) for authentication and if you'd like a basic tutorial on how to implement log in, log out, sign up and so on see … -
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.