Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

robots.txt File Generation Django

Project Description

Installation from Source

$ git clone git@github.com:jbergantine/django-robots.git
$ cd django-robots
$ python setup.py install

Installation via PIP Requirements File

Include in the PIP requirements file the following line:

-e git://github.com/jbergantine/django-robots.git#egg=django_robots

And then install as normal (IE:)

$ pip install -r path/to/requirements/file.txt

Testing

$ python setup.py test

With TOX

First, install Tox, then run the tests. This will test against the Django versions specified in the environments specified in the tox.ini file

$ pip install tox
$ tox

Setup the Project For the Application

Add to the project’s settings.py file tuple of installed apps:

'django_robots',

In the project’s urls.py file add:

url(r'^robots.txt', include('django_robots.urls')),

Enable the sites framework in the project’s settings.py file:

  1. Add 'django.contrib.sites' to your INSTALLED_APPS setting.
  2. Define a SITE_ID setting:
SITE_ID = 1
  1. Run syncdb.

From the Django Admin, configure the Domain Name and Display Name for the site, the domain name will be used in the robots.txt file to point to the absolute URL of the site’s sitemap.xml file.

Configure the robots.txt Template

By default the robots.txt template only includes a directive to point to the sitemap at http://site_url/sitemap.xml. This should be removed if the site doesn’t have an XML sitemap for some reason. If you’re using virtualenv, to copy the templates from the project in order to make adjustments to them, cd to the root of the django project and execute the following command:

cp -r ../src/django-robots/django_robots/templates/robots templates/robots

Template Tags Installed

current_site_url

Returns a full URL for the current site including custom protocol and port if set (i.e. https://example.com:8080).

Example usage:

{% load current_site_url %}
{% current_site_url %}

Release History

This version
History Node

1.1.1

History Node

1.0

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
django_robots-1.1.1-py2.py3-none-any.whl
(8.1 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Dec 2, 2015
django-robots-1.1.1.tar.gz
(4.8 kB) Copy SHA256 Hash SHA256
Source None Dec 2, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting