← All framework guides

Django SEO: 6 checks and how to fix them

These are the Django-specific checks RankCLI runs, and the fix for each one in Django's own idiom. Django renders on the server by default, which removes a whole class of SEO problems before you start.

6 checks
1 rated error
server-rendered
SSR by default

Run all of these against your own site, free and without an account:

npx @rankcli/cli audit -u https://your-site.dev

What Django gives you for free

  • •Server-rendered HTML by default
  • •Built-in sitemap framework
  • •Admin interface for content management
  • •Mature ecosystem

The checks

warning
DJANGO_NO_SITEMAP

Django sitemap framework not configured

Django has a built-in sitemap framework that should be used.

Add sitemap to your project:

# settings.py
INSTALLED_APPS = [
    'django.contrib.sitemaps',
]

# sitemaps.py
from django.contrib.sitemaps import Sitemap
from .models import Post

class PostSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.8

    def items(self):
        return Post.objects.filter(published=True)

    def lastmod(self, obj):
        return obj.updated_at

# urls.py
from django.contrib.sitemaps.views import sitemap
from .sitemaps import PostSitemap

sitemaps = {'posts': PostSitemap}

urlpatterns = [
    path('sitemap.xml', sitemap, {'sitemaps': sitemaps}),
]
warning
DJANGO_NO_META_FRAMEWORK

No SEO meta framework detected

Use django-meta for consistent meta tag management.

Install django-meta:

pip install django-meta
# settings.py
INSTALLED_APPS = ['meta']

META_SITE_PROTOCOL = 'https'
META_USE_OG_PROPERTIES = True
META_USE_TWITTER_PROPERTIES = True
# In views or models
from meta.views import MetadataMixin

class PostDetailView(MetadataMixin, DetailView):
    def get_meta_title(self):
        return self.object.title

    def get_meta_description(self):
        return self.object.excerpt
error
DJANGO_DEBUG_TRUE

DEBUG mode appears enabled

DEBUG=True in production exposes sensitive information and hurts performance.

Ensure DEBUG is False in production:

# settings.py
DEBUG = os.environ.get('DEBUG', 'False') == 'True'

Or use django-environ:

import environ
env = environ.Env(DEBUG=(bool, False))
DEBUG = env('DEBUG')
warning
DJANGO_NO_CACHE

Caching not configured

Django without caching is slower than it should be.

Configure caching in settings.py:

# Redis (recommended)
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.redis.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379',
    }
}

# Use cache in views
from django.views.decorators.cache import cache_page

@cache_page(60 * 15)  # 15 minutes
def my_view(request):
    ...
notice
DJANGO_NO_GZIP

GZip middleware not enabled

Enable GZip compression for faster page loads.

Add GZip middleware:

# settings.py
MIDDLEWARE = [
    'django.middleware.gzip.GZipMiddleware',
    # ... other middleware
]
notice
DJANGO_NO_WHITENOISE

Static files not optimized

Use WhiteNoise for efficient static file serving.

Install and configure WhiteNoise:

pip install whitenoise
# settings.py
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    # ...
]

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

Check your own Django site

280+ checks including every one above. No signup, nothing leaves your machine.

Run a free audit