{"id":9666,"library":"django-contrib-comments","title":"Django Contrib Comments","description":"django-contrib-comments is a standalone Django application providing a robust system for handling user comments. It was extracted from Django core as of version 1.6 and is actively maintained. The current stable version is 2.2.0, with releases typically aligning with major Django versions.","status":"active","version":"2.2.0","language":"python","source_language":"en","source_url":"https://github.com/django/django-contrib-comments","tags":["django","comments","contrib"],"install":[{"cmd":"pip install django-contrib-comments","lang":"bash","label":"Install the package"}],"dependencies":[{"reason":"Core framework dependency, requires Django>=3.2.","package":"Django","optional":false}],"imports":[{"wrong":"from django_comments.models import Comment","symbol":"Comment","correct":"from django_comments import get_model"}],"quickstart":{"code":"import os\n\n# --- In your project's settings.py ---\nINSTALLED_APPS = [\n    # Required Django core apps\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    'django.contrib.sites', # REQUIRED for django-contrib-comments\n    # The comments app itself\n    'django_comments',\n    # ... your other apps\n]\n\nSITE_ID = int(os.environ.get('DJANGO_SITE_ID', 1)) # REQUIRED for django-contrib-comments\n\n# --- In your project's urls.py ---\nfrom django.contrib import admin\nfrom django.urls import path, include\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    # Include the comments app's URLs\n    path('comments/', include('django_comments.urls')),\n    # ... your application-specific URLs where comments will be rendered\n]\n\n# After configuring these, run: python manage.py migrate","lang":"python","description":"Configure your Django project's `settings.py` and `urls.py` to include `django-contrib-comments`. Ensure `django.contrib.sites` is in `INSTALLED_APPS` and `SITE_ID` is set. After setup, run `python manage.py migrate` to create comment-related database tables. Finally, integrate the comment template tags into your desired templates (e.g., using `{% load comments %}`, `{% render_comment_list for object %}`, and `{% get_comment_form for object as form %}`)."},"warnings":[{"fix":"Install `django-contrib-comments` via pip, update `INSTALLED_APPS` to `'django_comments'`, and adjust all import paths from `django.contrib.comments` to `django_comments`.","message":"The comments application was removed from Django core (django.contrib.comments) in Django 1.6. Projects upgrading from older Django versions must install and configure `django-contrib-comments` as a standalone package.","severity":"breaking","affected_versions":"<1.6 (original Django core), >=1.6 (new package)"},{"fix":"Add `'django.contrib.sites'` to `INSTALLED_APPS` and define `SITE_ID` (e.g., `SITE_ID = 1`) in your `settings.py`.","message":"The `django.contrib.sites` framework and the `SITE_ID` setting are mandatory dependencies for `django-contrib-comments` to function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"After adding `'django_comments'` to `INSTALLED_APPS`, run `python manage.py migrate`.","message":"Database tables for comments will not be created without running Django migrations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"In your template, load the comment tags with `{% load comments %}`. Then use tags like `{% render_comment_list for object %}` and `{% get_comment_form for object as form %}` to display comments and the comment form.","message":"Displaying comments in templates requires specific template tags and context.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.6':30 '2.2.0':40 'activ':33 'align':44 'applic':12 'comment':3,7,20,50 'contrib':2,6,51 'core':26 'current':36 'django':1,5,11,25,47,49 'django-contrib-com':4 'extract':23 'handl':18 'maintain':34 'major':46 'provid':13 'releas':42 'robust':15 'stabl':37 'standalon':10 'system':16 'typic':43 'user':19 'version':29,38,48","created_at":"2026-04-17T01:20:05.332223+00:00","updated_at":"2026-04-17T01:20:05.332223+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.2.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/django/django-contrib-comments","docs":null,"changelog":null,"pypi":"https://pypi.org/project/django-contrib-comments/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}