Skip to main content

djrobots

Project description

Logo Build Status codecov Latest Version

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.

If you want to disable all in your site, use in your settings

DJROBOTS_DISALLOWALL = True

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
$ make test

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.7.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

djrobots-0.0.7-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djrobots-0.0.7.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/18.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.0

File hashes

Hashes for djrobots-0.0.7.tar.gz
Algorithm Hash digest
SHA256 d2d5fb187eb52303e233c62afb4f1d45c9373731544da357b2b030a20e54964b
MD5 6899283ff1555d884e449eb25037ffd1
BLAKE2b-256 34ecb8e74c301c944e4f62bc723881d7b324cc2f704be260e6a87f7334a4fa9f

See more details on using hashes here.

File details

Details for the file djrobots-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: djrobots-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/18.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.0

File hashes

Hashes for djrobots-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 25184b8b8a20eab9fc339ad2210f489e931cc1610fd8197644a4c7e681a67f09
MD5 5d20c0d2f64210f3935e0398e3f79a9c
BLAKE2b-256 47ffe57c6f3018c73c9bf38e19e027d49cb61013d6cbead54e852d49f0a31795

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