Django 6.0 delivers a built-in background tasks framework to reduce dependency on Celery, native Content Security Policy support for enhanced security, and template partials for component-based development, alongside async improvements and expanded database function support.

Django 6.0 has been released, marking a significant update to the Python web framework with features aimed at modernizing development workflows, improving security, and reducing external dependencies. The release introduces a built-in background tasks framework, native Content Security Policy (CSP) support, template partials for modular templates, and enhanced async capabilities.
Built-In Background Tasks Framework
Django 6.0 includes a native tasks framework that allows developers to run code outside the HTTP request-response cycle without relying on third-party libraries like Celery. The framework provides a tasks module where developers can define tasks using decorators. Tasks are enqueued through a configured backend, and Django handles task creation and queuing. However, execution still requires external infrastructure, such as a worker process or cloud service.
This feature addresses a common pain point for Django developers who previously needed to integrate Celery for background processing. The built-in approach simplifies setup for common use cases like sending emails or processing data asynchronously. Community reaction has been largely positive, with developers on Hacker News and Reddit expressing enthusiasm for the reduced dependency on Celery.
Some criticism has emerged regarding the minimal default configuration. The framework does not include a default database backend or worker, which some users expected for basic applications. For instance, a Reddit user noted: "Very disappointed that the new background task doesn't come with a default basic db backend and worker as it did in the original django-task. That would have covered the needs of so many basic apps where you just need them to send some emails and run some crons."
Native Content Security Policy Support
Django 6.0 adds built-in support for Content Security Policy (CSP), a security mechanism that helps protect web applications against cross-site scripting (XSS) and other content injection attacks. The framework includes ContentSecurityPolicyMiddleware, which enforces CSP policies configured through Python dictionaries and Django-provided constants.
Developers can define policies in settings, such as specifying allowed sources for scripts, styles, and other resources. This native integration eliminates the need for external packages like django-csp, streamlining security implementation. CSP support is particularly valuable for applications handling sensitive data or user-generated content, as it provides a defense-in-depth layer against common web vulnerabilities.
Template Partials for Component-Based Development
The release introduces template partials, enabling developers to encapsulate and reuse named fragments within template files. New tags like partialdef and partial allow for more modular templates without splitting components into separate files. This approach supports component-based development patterns, making templates easier to maintain and reuse across projects.
For example, a partial can be defined for a reusable UI component like a header or card, then invoked with specific context. This reduces duplication and improves code organization, especially in large applications with complex frontends.
Async Support and Database Enhancements
Django 6.0 expands async capabilities with AsyncPaginator and AsyncPage classes, improving performance for asynchronous views and database queries. These additions build on Django's existing async support, allowing for non-blocking pagination in async contexts.
Database function support has been broadened across backends. The StringAgg function, previously limited to PostgreSQL, is now available on other databases, enabling more consistent query building. GIS capabilities are also enhanced with new geometry functions and lookups, benefiting applications that handle geospatial data.
Python Version Support and Migration
The release drops support for Python 3.10 and 3.11, adding compatibility with Python 3.12, 3.13, and 3.14. This aligns with Python's release cycle and encourages adoption of newer versions. Django provides a comprehensive upgrade guide for developers migrating from earlier versions, covering breaking changes and new features.
Real-World Implications
For development teams, Django 6.0 reduces the complexity of background task management by offering a native solution. While Celery remains a robust choice for advanced use cases, the built-in framework covers many common scenarios, potentially lowering the barrier to entry for asynchronous processing.
The native CSP support simplifies security hardening, making it easier to implement policies that comply with modern web standards. This is especially relevant for organizations with strict security requirements or those undergoing audits.
Template partials promote cleaner, more maintainable codebases, particularly in large projects where template reuse is critical. Combined with async improvements, these features support the evolution of Django applications toward more performant and scalable architectures.
Context and Broader Trends
Django's evolution reflects a broader trend in web frameworks toward reducing external dependencies and providing built-in solutions for common tasks. By integrating features like background tasks and CSP, Django aims to improve developer experience and application security out of the box.
The framework continues to power high-traffic websites across industries, from content management systems to API-driven applications. Its emphasis on rapid development and pragmatic solutions remains central, with these updates reinforcing its position in modern web development.
For more details, visit the official Django 6.0 release notes and the Django documentation. The tasks framework documentation provides specific guidance on implementation.

Author: Daniel Curtis is a UI Development Manager at Griffiths Waite, a software consultancy based in Birmingham, UK. He leads front-end engineering efforts with a strong focus on delivering innovative enterprise solutions using TypeScript across the stack.

Comments
Please log in or register to join the discussion