Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
First Major Model - Building SaaS with Python and Django #163
In this episode, we got to work on the core modeling for the application. I started by adding some visualization tooling to see the models in the system, then got to modeling of the primary Entry model that will be used throughout the app. Along the way, we set up the Django admin and did some automated testing. -
How to Learn Django (Replay)
Learning Python via Django Considered HarmfulDjango Girls TutorialDjango for BeginnersInstall Python3 on Mac/Windows/Linuxawesome-django repodjango-vanilla-viewsClassy Class-Based Views siteDjango Deployment ChecklistGroupsDjango Users Google GroupStack OverflowSubreddits: LearningDjango and DjangoDjango MeetupsSHAMELESS PLUGSLearnDjango.comCarlton's website Noumenal -
2023 Python Software Foundation Board Nomination
My self-nomination statement for the 2023 Python Software Foundation (PSF) Board Election -
2023 Python Software Foundation Board Nomination
My self-nomination statement for the 2023 Python Software Foundation (PSF) Board Election -
Python Community News Interview
Interview I gave to the “Python Community News” channel regarding my self-nomination for the 2023 Python Software Foundation (PSF) Board of Directors elections. -
FeinCMS is a dead end (but feincms3 is not)
FeinCMS is a dead end (but feincms3 is not) I wouldn’t encourage people to start new sites with FeinCMS. Five years ago I wrote that FeinCMS is used in a few flagship projects which we’re still actively developing, which means that FeinCMS won’t be going away for years to come. That’s still true but less and less so. We’re actively moving away from FeinCMS where we can, mostly towards feincms3 and django-content-editor. FeinCMS lives on in django-content-editor and feincms3; not only in spirit but also in (code) history, since django-content-editor contains the whole history of FeinCMS up to and including the beginning of 2016. The implementation of FeinCMS is too expensive to clean up without breaking backwards compatibility. I still wish I had pursued an incremental way back then which would have allowed us to evolve old projects to the current best way of doing things (tm), but it didn’t happen and I’m not shedding too many tears about that since I’m quite happy with where we’re at today. That basically means that I won’t put any effort into bringing FeinCMS and django-content-editor closer together. I haven’t spent much time on that anyway but now my mind is made up … -
Python + Upsolver: Simplified Realtime Data Workflows
One of the powerful things about Python is its ability to connect disparate tools into one common integrated development experience. In this talk, we’ll explore how to create and run a near real-time pipeline where we consume events from a Kafka topic and transform the data before landing them in the lake, using Upsolver through our Python SDK. In this way, we get exactly-once processing, strong ordering and automatic schema evolution out of the box thanks to the powerful Upsolver engine, but without having to switch to a different UI and building in SQL only. -
Weeknotes (2023 week 24)
Weeknotes (2023 week 24)Life happened and I missed a month of weeknotes. Oh well. django-debug-toolbar 4.1 We have released django-debug-toolbar 4.1. Another cycle where I mostly contributed reviews and not much else. Feels great :-) Going all in on hatch and hatchling I got to know hatch because django-debug-toolbar was converted to it. I was confused as probably anyone else with the new state of packaging in Python world. After listening to a few Podcasts (for example Hatch: A Modern Python Workflow) I did bite the bullet and started converting projects to hatch as mentioned some time ago. I have converted a few other projects in the meantime because the development experience is nicer. Not much, but enough to make it worthwile. feincms3-sites is the latest package I converted. CKEditor 5’s new license and django-ckeditor The pressure is on to maybe switch away from CKEditor 4 since it probably will not be supported after June 2023. It’s totally understandable that the CKEditor 5 license isn’t the same as before, but I’m not sure what that means for the Django integration django-ckeditor which I’m maintaining since a few years. I don’t actually like the new capabilities of CKEditor all that much … -
Django News - Python 3.7 to 3.12 updates - Jun 16th 2023
News New Python 3.7 to 3.11 releases and 3.12.0 beta 2 are now available Another combined release of six separate versions of Python including 3.12.0 beta 2! blogspot.com PEP 703: Making the Global Interpreter Lock Optional (3.12 updates) A very informed discussion on PEP 703 to make the Python GIL optional. python.org Migrate your project to .readthedocs.yaml configuration file v2 An important deprecation announcement from ReadTheDocs: a .readthedocs.yml file will soon be required configuration on all projects. readthedocs.com Django Software Foundation Django Software Foundation June meeting minutes Meeting minutes for DSF Board monthly meeting, June 8, 2023. djangoproject.com Updates to Django Updates to Django Courtesy of Django Review and Triage Team Member Sarah Boyce... Last week we had 16 pull requests merged into Django by 11 different contributors - including 3 first time contributors! Congratulations to XDEv11, EBIBO, and Howard Cox for having their first commits merged into Django - welcome on board! This time there were even more accessibility improvements to the Django admin! For example, active row highlighting was added when in forced color mode. Did you know about forced color mode? I didn't! Love learning about how to make the web more accessible. github.com Sponsored Link Ready … -
Django: A security improvement coming to format_html()
Can you spot the problem with this Django snippet? from django.utils.html import format_html def user_snippet(user): return format_html(f"<em>{user.name}</em>") Well, the problem is that format_html() is passed an already-templated string! Its escaping ability is not being used. If the user name contains HTML, it will be injected into the final output: In [2]: user_snippet(User(name="<script>Bobby Tables</script>")) Out[2]: '<em><script>Bobby Tables</script></em>' Oh no! This is known as an XSS (cross-site-scripting) vulnerability. format_html() exists to protect against XSS, when used correctly. Here’s the correct way to use it: from django.utils.html import format_html def user_snippet(user): return format_html("<em>{}</em>", user.name) format_html() is passed the HTML template and the variables to add into it. It safely escapes any HTML characters in the variables. I’ve seen plenty of the misuse shown in the first pattern, with f-strings, str.format(), and %-formatting. It seems like an easy mistake to make, even an “attractive nuisance”. Two weeks ago, whilst at DjangoCon Europe, I proposed that Django deprecate the ability for format_html() calls without any arguments in Ticket #34609. The ticket was quickly accepted and Bhuvnesh Sharma picked it up and wrote the patch. Mariusz Felisiak reviewed and merged it in commit 094b0bea2c. Thanks both! Starting from Django 5.0, there’ll be a warning if you … -
CSS variables and immutability
Using CSS variables1 to ship customizable CSS in Django apps I have been working with SASS for a long time but have been moving towards writing CSS with a few PostCSS goodies in the last years. At first, I just replaced the $... with var(--...) and didn’t think much about it. The realization that CSS variables can be more than that came later. Edit basic values directly in the browser and immediately see the results! Change CSS depending on media queries or the cascade! With all that power came back the wish to not just ship backend and HTML code in Django apps I (help) maintain but also reusable CSS, with a few overrideable CSS variables for basic changes to the visual style. Loading .scss files from somewhere inside venv/lib/python3.11/site-packages/<package>/styles/ would of course have been possible, but very obscure. Also, not everyone puts their virtualenv at venv, the README instructions for those packages would quickly have become unwieldy. CSS variables paved the way for shipping CSS as a Django static file while still allowing customizability by leveraging the functionality of the browser itself instead of the frontend build toolchain. Patterns for overrideable values A pattern for defining defaults for CSS … -
Django QuerySets Tutorial
A [Django Queryset](https://docs.djangoproject.com/en/dev/ref/models/querysets/) is a collection of (SQL) [queries](https://docs.djangoproject.com/en/4.2/topics/db/queries/) from the database. It is a way to filter and order data that is then presented to the user, typically in … -
Django News - Django bugfix release 4.2.2 - Jun 9th 2023
News Django bugfix release: 4.2.2 Features 11 new bugfixes. See the complete notes for more. djangoproject.com Official Django Merchandise Did you know there is an official Django merchandise store? Represent Django in your community with a t-shirt, sweatshirt, hoody, or baby gear. All proceeds are donated to the Django Software Foundation. threadless.com “Boost Your Git DX” available in early access This is the latest book from Adam Johnson, a member of the Django 5.x Steering Council. His past books include Speed Up Your Django Tests and Boost Your Django DX. adamj.eu Updates to Django Django PRs this week Courtesy of Django Review and Triage Team Member Sarah Boyce... On the week starting May 29th, we had 11 pull requests merged into Django by 10 different contributors - including 5 first time contributors! Congratulations to Kacper Wolkiewicz, Christopher Cave-Ayland, AP Jama, Cheuk Ting Ho and Nina Menezes for having their first commits merged into Django - welcome on board! Included in this week were some accessibility improvements to the Django admin including enabling user zooming on mobile and adding icon descriptions in "Recent Actions" into 5.0. Big thank you to our accessibility team for helping our new contributors at the sprints! … -
Finish Signup and CI - Building SaaS with Python and Django #162
In this episode, I continued on the signup flows that started in the previous stream. We configured the email backend and verified that the end to end signup flow worked. Then I set up the templates system and added the initial templates for the confirmation email the index view of the whole site. The stream ended with configuring test coverage and setting up CI with GitHub Actions and pre-commit.ci -
Django Co-Creator - Simon Willison (Ep 21 Replay)
Simon Willison’s WeblogDatasetteNow by ZeitGoogle Cloud Runsqljs.orgBrython - Python 3 in the browserSquoosh - Image CompressionObservableSimon Willison PyCon 2019 - Instant serverless APIs, powered by SQLiteasgi-corsSHAMELESS PLUGSLearnDjango.comCarlton's website NoumenalDjango News Newsletter -
Django News - djangoproject.com website redesign! - Jun 2nd 2023
News Help us make the djangoproject.com website better The 20tab agency is currently engaged in a pro-bono redesign of the djangoproject.com website. Please fill out this short survey to help. google.com Thinking about running for the Python Software Foundation Board of Directors? Let’s talk! This year’s Board Election Nomination period is open. Current board members want to share what being on the board is like and are making themselves available to answer all your questions about responsibilities, activities, and time commitments via online chat. blogspot.com Enforcement of 2FA for upload.pypi.org began June 1st, 2023 PyPI now requires all uploads from accounts with 2FA enabled to use an API token or Trusted Publisher configuration. pypi.org PEP 594 has been implementated: Python 3.13 removes 20 stdlib modules Python 3.13 removes 20 stdlib modules and Python 3.12 removed 5 stdlib modules. Check out this forum post to see what modules were removed. python.org PEP 658 is now live on PyPI - Packaging Wheels uploaded to PyPI will have their METADATA files served along side them on files.pythonhosted.org , and the appropriate information served in the Simple API to determine if the file as available. python.org Updates to Django Django PRs this week We're … -
New SaaS Signup - Building SaaS with Python and Django #161
In this episode, we dug into the first portion of the journey SaaS. I acquired the domain name of journeyinbox.com for this service. That service is not live yet. We started at the beginning to set up users and sign up features. -
Frequently Asked Questions about Django
## What is Django? Django is a Python web framework that takes care of the difficult parts of web development--authentication, database connection, CRUD (Create, Read, Update, Delete) operations, URL routing, … -
Django News - DjangoCon Europe in Edinburgh starts Monday! - May 26th 2023
News DjangoBook.com This classic domain--first used to host a free book on Django written by Adrian Holovaty and Jacob Kaplan-Moss--is now a community guide to current books on Django. djangobook.com Python 3.12.0 beta 1 released Python 3.12 is still in development. This release, 3.12.0b1, is the first of four planned beta release previews of 3.12. blogspot.com python2.7 will be removed from the python-versions on June 19 GitHub is dropping platform support (actions/setup-python ) for Python 2.7 on June 19th. Python2.7 was officially sunset on January 1, 2020. github.com PyPI was subpoenaed The PSF received three subpoenas from the US Department of Justice for PyPI user data in March and April of 2023. In additional news, PGP signatures will be removed from PyPI going forward. pypi.org Django Feeds A valuable resource on Django tutorials in video, podcast, and book format. djangofeeds.com Updates to Django Django PRs May 14th - 22nd We're trying out a new category, curated by Sarah Boyce, highlighting contributions to the Django codebase. On the week starting May 15th, we had 10 pull requests merged into Django by 8 different contributors - including 3 first time contributors! Congratulations to Julie Rymer, Dingning and Rajeesh Punathil for having their … -
PyGrunn 2023: modern python through fastAPI and friends - Sebastián Ramírez
(One of my summaries of the May 2023 Dutch PyGrunn conference). Sebastián Ramírez ("tiangolo") has created fastAPI (and other open source projects). He talks about modern python. With modern python he means 3.7+. One of the new items: f-strings, formatted strings. f"Hi {name}". Type annotations, type hints. We've been working without type annotations all this time, so why should we add them? Well, for instance for great editor support. Suddenly the editor's autocompletion is way better. If the editor knows some variable is a string, it can offer autocompletion for the variable by showing string's methods. You also get better errors in your editor when multiplying by something that can also be a None, for instance. Type annotations are used a lot in fastAPI. @app.get("/recipes/{name}") as a decorator on a view function and a type "string" on the name argument and you get autocompletion. And type checking in the fastAPI api with automatic input validation. And you get data conversion: a ?quantity=2 in a URL is basically a string. But fastAPI knows it should be converted into an integer. Typer is a library for using the same functionality for command line interfaces. Including tab completion. A tip: use rich to … -
PyGrunn 2023: software design tips for lazy people - Arjan Egges
(One of my summaries of the May 2023 Dutch PyGrunn conference). Arjan Egges runs the ArjanCodes youtube channel. "Software design" often sounds like "huge diagrams with lots of arrows". Sometimes software design is complicated, like determining what the customer actually wants. Or a big change in your mayor concept. Or fitting together completely different technologies, especially when they are opinionated. What you also hear... "the code works, I don't have time for refactoring". "I have deadlines, and it works, so I don't have to write tests". "I just ask chatgpt to clean my code". His main point: software design is about consistently taking slightly different decisions while you're coding. These decisions compound and should make you code faster and better. He has seven tips for us: Name wisely. This about categorising things. Being clear about what it is. Even better: a good name makes sure you yourself knows what something is :-) If you cannot find a good name for something, perhaps you should approach the problem in a different way? Perhaps you should turn your class into a couple of functions. If a function has "and" in the name: perhaps it should be split into two separate functions. If … -
PyGrunn 2023: frontend for backenders ("twinspark") - Alexander Solovyov
(One of my summaries of the May 2023 Dutch PyGrunn conference). Single page applications (SPA) suck! Stop building them! (He worked on them for the last 12 years :-) ) The promises of SPAs: UI is a function of the state. A unified API for UI and native apps. Nice composability. Better long-term maintentance. And faster development because you can split in backend and frontend teams. 6 years later... 2.5MB minimized javascript. Page speed perfomance sucked. The negative side of SPAs: Performance is bad. Complexity is through the roof. Display logic in your app logic. Business logic creeps into your clients. The codebase is split. And the tech split makes people feel helpless. The backenders are excluded from the frontend so they just start to care about the API. The frontenders complain about the unusable API that doesn't care about the frontend... Back to jquery? Never. It takes only two years instead of six years for your code to go bad. Composability doesn't even exist as a word in jquery. Logic spread out everywhere. We need a modern interactive site. What do we actually want? Composability. Understandability. Server-side html rendering and a minimum of javascript. Empowered backend developers. He demoed … -
PyGrunn 2023: FastAPI with Django - Ivor Bosloper
(One of my summaries of the May 2023 Dutch PyGrunn conference). Ivor works for dacom, a GIS and agri company. They use both django and fastAIP. FastAPI is a relatively new web framework for building REST APIs. The ingredients are pydantic, data validation based on python type hints, and starlette, an asgi async toolkit. With pydantic you can define classes/models of your data. With python type hints. Pydantic takes care of the type checking and also converts the input to the correct type. With Django, you'll get the correct type out of the database, but it won't automatically fix up the model you're instantiating yourself. He showed a simple django app with two models ("Farm" and "Field"). Right next to it he generated a fastAPI app. In the asgi.py file he hooked up django as usual and added a fastAPI app to the router. So django and fastapi run side by side. He showed the django admin, running as usual, and /api/ with the fastAPI functionality. He uses fastapi-utils for a "DTO", data transfer object. fastapi-models has an APIModel class to map pydantic models to models in some other system. In this case django's ORM. Seemed to work like a … -
PyGrunn 2023: optimization for mere mortals - Dulaj Disanayaka
(One of my summaries of the May 2023 Dutch PyGrunn conference). Mere mortals? There are two kinds pf people in the world: those that like to optimize and those that are mere mortals :-) He'll try to get us over to the optimization side. Python is pretty slow. It is getting faster and faster all the time, though. And speed isn't everything: readability and maintainability are also important. And a large community. Optimization at the language level will be talked about in the "python under the hood" later during this conference. Something you often hear: Premature optimizaton is bad. Worrying about efficiency in the wrong places and at the wrong times is a real problem accourding to Donald Knuth. Micro-optimization is bad. But... is that so? A small part of your code might be called lots of times. Have you profiled it? Look at the ROI (return on investment). Time spend optimizing code that isn't the actual problem is time that is wasted. Time spend on slow code that is called a lot, that's a good thing. What he's suggesting is what he calls opportunistic optimization. It is a bit like the "boy scouts' rule": make the code a little … -
PyGrunn 2023: your API on-the-fly - Jan Murre
(One of my summaries of the May 2023 Dutch PyGrunn conference). API on the fly? The talk is about autogenerating APIs using "Amsterdam Schema". Jan works for datapunt Amsterdam, a project for being transparant as the city of Amsterdam. Your citizens pay taxes, so they have a right to access the open data that the municipality maintains. They have api projects for many datasets. Like "BAG", the official building database. Or a list of the power sockets for the weekly markets. Lots of geographical information. They use postgres, docker containers, ubuntu, python + django + djangorestframework. Developed specific for this project: django gisserver. DSO, digitaal stelsel omgevingswet, is a Dutch API specification for this kind of data. The various sorts of data are all specified in a json format that they call Amsterdam Schema. All data sets are available as geographical layers. They have a custom django management command (import_schemas --create-tables) to read such a json schema file and create the empty tables in the database. He demonstrated (live) how it works. The data was in the dabase and a nice swagger-like page was shown in the website with the option to browse the REST API. There's even support for …