Skip to main content

djrobots

Project description

Our internal utility to easily have robots.txt both for development and production

Install

pip install djrobots

Usage

Include djrobots urls to your URLconf and your’re done!

(r'^robots\.txt$', include('djrobots.urls')),

and add djrobots to your INSTALLED_APPS

Sitemap

If you want to specify the sitemap urls in your robots.txt, provide the view name in the settings

DJROBOTS_SITEMAPS = 'sitemap-root'

DJROBOTS_SITEMAPS is a special setting, you can use an array to specify more sitemaps in your robots.txt

DJROBOTS_SITEMAPS = ['sitemap-root', 'department-sitemap']

or you can mix view names with raw urls

DJROBOTS_SITEMAPS = ['sitemap-root', 'department-sitemap', '/my-sitemap-index.xml']

Customization

By default djrobots provides a robots.txt template for production and a robots-debug.txt for development with a default configuration used internally at Lotrek.

If you want to specify more directives you can extend default templates, robots.txt and robots-debug.txt

{% extends "djrobots/base-robots.txt" %}
{% block content %}
User-agent: *
Disallow: /cgi-bin/
Disallow: /tmp/
Disallow: {% url 'documents' %}

Host: example.com

{% endblock %}

Run tests

$ pip install -r requirements-dev.txt
$ ./runtests.py --with-coverage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djrobots-0.0.5.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file djrobots-0.0.5.tar.gz.

File metadata

  • Download URL: djrobots-0.0.5.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djrobots-0.0.5.tar.gz
Algorithm Hash digest
SHA256 62a2529b2842788b0a801e90f342515a889318410cbb93e9664a973ca1a8f729
MD5 8bf9f50c3fc12240ce02d3f69eed4205
BLAKE2b-256 ca230c8ada2793cf7667046afc7b0d293e72338617e3250609addb5c1a087108

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page