Skip to content
  • There are no suggestions because the search field is empty.

How do I integrate Prerender.io with Django?

Use the community-maintained django-seo-js package to connect Prerender.io to your Django application so AI crawlers and search engines receive fully rendered HTML.

TL;DR

Install the community-maintained prerender-django package, add its middleware and your Prerender.io token to settings.py, and restart your server. The middleware detects AI crawlers and search engine bots and routes their requests through Prerender.io's rendering service. Your website visitors are not affected.

Step 1: log in to your Prerender.io dashboard and copy your token.

You will need your Prerender.io token for Step 3. Log in to your Prerender.io dashboard and find your token under the Security and Access menu.

Copy the token and keep it ready.

Step 2: install the prerender-django package.

Run the following command in your terminal

pip install prerender-django

Then add prerender-django to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [  
    # your other apps
    'prerender-django', 
]                   

The source code is available on GitHub. This is a community-maintained package, not an official Prerender.io integration.

Step 3: configure the middleware and token in settings.py.

Add the Prerender.io middleware to the top of your MIDDLEWARE list so it intercepts crawler requests before other middleware processes them:

MIDDLEWARE = [
    'prerender_django.middleware.PrerenderMiddleware',
    # ... your other middleware
]

 

Then add your Prerender.io token: 

   PRERENDER_TOKEN = 'YOUR_TOKEN'                      

 Replace YOUR_TOKEN with the Prerender.io token you copied in Step 1. 

 ⚠️ Do not commit your real token to a public repository. Use an environment variable (e.g., os.environ.get('PRERENDER_TOKEN')) to keep it secure. 

Step 4: restart your Django server.

Restart your server using your normal deployment process. For example:

# Gunicorn
sudo systemctl restart gunicorn
 
# uWSGI
sudo systemctl restart uwsgi
 
# Docker
docker-compose restart web
 
 

Step 5: verify your integration is working.

After restarting, confirm that Prerender.io is intercepting crawler requests and serving rendered HTML.

Test with a curl command using a crawler user-agent:

 curl -v -A "Googlebot" https://www.yoursite.com/ 

Check the response headers for the x-prerender-request-id header. When using the hosted Prerender.io service, this header confirms Prerender.io is serving the page.

Alternatively, follow the full verification guide for step-by-step instructions using Chrome DevTools.

✅ Your integration is working when a simulated bot request returns an x-prerender-request-id response header (hosted Prerender.io service) and cached pages appear in your Prerender.io dashboard.

If you see the message Prerender Integration Not Detected, follow the troubleshooting guide for integration detection errors.


Related articles


💬 Support Info: Since django-seo-js is community-maintained, Prerender.io cannot troubleshoot package-specific issues.

 

Was this article helpful?