Feed: Simon Willison's Weblog: django

Quoting Django’s security policies

July 11, 2025 » Simon Willison's Weblog: django » [Archived Version]

Following the widespread availability of large language models (LLMs), the Django Security Team has received a growing number of security reports generated partially or entirely using such tools. Many of these contain inaccurate, misleading, or fictitious content. While AI tools can help draft or analyze reports, they must not replace human understanding and review. If you use AI tools to help prepare a report, you must: Disclose which AI tools were used and specify what they were used for (an…

Read More

PR #537: Fix Markdown in og descriptions

June 3, 2025 » Simon Willison's Weblog: django » [Archived Version]

PR #537: Fix Markdown in og descriptions Since OpenAI Codex is now available to us ChatGPT Plus subscribers I decided to try it out against my blog. It's a very nice implementation of the GitHub-connected coding "agent" pattern, as also seen in Google's Jules and Microsoft's Copilot Coding Agent. First I had to configure an environment for it. My Django blog uses PostgreSQL which isn't part of the default Codex container, so I had Claude Sonnet 4 help me come up with a startup recipe to get Pos…

Read More

django-simple-deploy

May 17, 2025 » Simon Willison's Weblog: django » [Archived Version]

django-simple-deploy Eric Matthes presented a lightning talk about this project at PyCon US this morning. "Django has a deploy command now". You can run it like this: pip install django-simple-deploy[fly_io] # Add django_simple_deploy to INSTALLED_APPS. python manage.py deploy --automate-all It's plugin-based (inspired by Datasette!) and the project has stable plugins for three hosting platforms: dsd-flyio, dsd-heroku and dsd-platformsh. Currently in development: dsd-vps - a plugin that should…

Read More

Django: what’s new in 5.2

April 10, 2025 » Simon Willison's Weblog: django » [Archived Version]

Django: what’s new in 5.2 Adam Johnson provides extremely detailed unofficial annotated release notes for the latest Django. I found his explanation and example of Form BoundField customization particularly useful - here's the new pattern for customizing the class= attribute on the label associated with a CharField: from django import forms class WideLabelBoundField(forms.BoundField): def label_tag(self, contents=None, attrs=None, label_suffix=None): if attrs is None: …

Read More

Composite primary keys in Django

April 2, 2025 » Simon Willison's Weblog: django » [Archived Version]

Composite primary keys in Django Django 5.2 is out today and a big new feature is composite primary keys, which can now be defined like this: class Release(models.Model): pk = models.CompositePrimaryKey( "version", "name" ) version = models.IntegerField() name = models.CharField(max_length=20) They don't yet work with the Django admin or as targets for foreign keys. Other smaller new features include: All ORM models are now automatically imported into ./manage.py shell…

Read More

suitenumerique/docs

March 17, 2025 » Simon Willison's Weblog: django » [Archived Version]

suitenumerique/docs New open source (MIT licensed) collaborative text editing web application, similar to Google Docs or Notion, notable because it's a joint effort funded by the French and German governments and "currently onboarding the Netherlands". It's built using Django and React: Docs is built on top of Django Rest Framework, Next.js, BlockNote.js, HocusPocus and Yjs. Deployments currently require Kubernetes, PostgreSQL, memcached, an S3 bucket (or compatible) and an OIDC provider. …

Read More

Smoke test your Django admin site

March 13, 2025 » Simon Willison's Weblog: django » [Archived Version]

Smoke test your Django admin site Justin Duke demonstrates a neat pattern for running simple tests against your internal Django admin site: introspect every admin route via django.urls.get_resolver() and loop through them with @pytest.mark.parametrize to check they all return a 200 HTTP status code. This catches simple mistakes with the admin configuration that trigger exceptions that might otherwise go undetected. I rarely write automated tests against my own admin sites and often feel guilty …

Read More

My approach to running a link blog

Dec. 22, 2024 » Simon Willison's Weblog: django » [Archived Version]

I started running a basic link blog on this domain back in November 2003 - publishing links (which I called "blogmarks") with a title, URL, short snippet of commentary and a "via" link where appropriate. So far I've published 7,607 link blog posts and counting. In April of this year I finally upgraded my link blog to support Markdown, allowing me to expand my link blog into something with a lot more room. The way I use my link blog has evolved substantially in the eight months since then. I'm g…

Read More

Is async Django ready for prime time?

Nov. 24, 2024 » Simon Willison's Weblog: django » [Archived Version]

Is async Django ready for prime time? Jonathan Adly reports on his experience using Django to build ColiVara, a hosted RAG API that uses ColQwen2 visual embeddings, inspired by the ColPali paper. In a breach of Betteridge's law of headlines the answer to the question posed by this headline is “yes”. We believe async Django is ready for production. In theory, there should be no performance loss when using async Django instead of FastAPI for the same tasks. The ColiVara application is itself op…

Read More

django-plugin-django-debug-toolbar

Nov. 13, 2024 » Simon Willison's Weblog: django » [Archived Version]

django-plugin-django-debug-toolbar Tom Viner built a plugin for my DJP Django plugin system that configures the excellent django-debug-toolbar debugging tool. You can see everything it sets up for you in this Python code: it configures installed apps, URL patterns and middleware and sets the INTERNAL_IPS and DEBUG settings. Here are Tom's running notes as he created the plugin. Via @tomviner Tags: djp, django, plugins

Read More