{"id":23564,"library":"django-components","title":"django-components","description":"A library to create simple reusable template components in Django. Current version is 0.149.0, with active development and frequent releases (multiple per month). It supports Django 4.2+ and Python 3.10+. Key features include component slots, dynamic CSS/JS, and component nesting.","status":"active","version":"0.149.0","language":"python","source_language":"en","source_url":"https://github.com/django-components/django-components/","tags":["django","components","templates","reusable"],"install":[{"cmd":"pip install django-components","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Framework requirement","package":"Django","optional":true}],"imports":[{"note":"Old import path (pre-v0.100) breaks; use top-level import.","wrong":"from django_components.component import Component","symbol":"Component","correct":"from django_components import Component"},{"note":"Incorrect submodule path.","wrong":"from django_components.library import render_to_response","symbol":"render_to_response","correct":"from django_components import render_to_response"}],"quickstart":{"code":"from django_components import Component\n\nclass Greeting(Component):\n    template = \"\"\"<div>Hello {{ name }}!</div>\"\"\"\n    \n    def get_context_data(self, name, **kwargs):\n        return {\"name\": name}\n\n# Render in template:\n# {% load component_tags %}\n# {% component \"greeting\" name=\"World\" / %}","lang":"python","description":"Define a simple component and render it in a Django template using the component_tags library."},"warnings":[{"fix":"Set django.template.backends.django.TEMPLATES loaders to cached.Loader only if you understand the caching; use FileSystemLoader for development.","message":"Component templates are cached. If you modify a template file, you must restart the server or clear Django's template cache to see changes. Use a cache backend with auto-reload in development.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate defaults to Kwargs: class Kwargs: show_details: bool = True","message":"Component.Kwargs is now the preferred way to define input defaults instead of a separate Component.Defaults class. Component.Defaults still works but may be removed in the future.","severity":"deprecated","affected_versions":">=0.143.0"},{"fix":"Use Python 3.10+ and Django 4.2+ or 5.0+.","message":"Dropped support for Python 3.8 and 3.9, and Django 5.1 in version 0.147.0. Older releases may have security issues.","severity":"breaking","affected_versions":">=0.147.0"},{"fix":"Update any JavaScript code referencing `window.Components` to `window.DjangoComponents`.","message":"Global JavaScript object renamed from `Components` to `DjangoComponents` in v0.146.0. Old object still available but deprecated.","severity":"gotcha","affected_versions":">=0.146.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add 'django_components' to INSTALLED_APPS in settings.py and run python manage.py migrate.","cause":"Forgetting to add 'django_components' to INSTALLED_APPS or not running migrate.","error":"TemplateSyntaxError: 'django_components' is not a registered tag library"},{"fix":"Register the component with @register('name') or use {% component 'name' / %} syntax after version 0.140.","cause":"Using the deprecated {% component_block %} syntax without registering the component.","error":"KeyError: 'component_name'"},{"fix":"Upgrade to latest: pip install -U django-components; use from django_components import Component.","cause":"Outdated version or incorrect import path.","error":"ImportError: cannot import name 'Component' from 'django_components'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}