Skip to main content

A django app to change robots.txt from the admin panel without using the database.

Project description

Django CS Robots

A simple, database-free Django app to manage your robots.txt file directly from the admin interface.

This package provides a straightforward solution for allowing site administrators to edit the robots.txt file without developer intervention. Instead of storing the content in a database model, this app reads from and writes directly to a physical file on your server. The file's path is fully configurable in your project's settings.py.

Key Features

Edit in the Admin: Provides a simple and intuitive form within the Django admin to modify your robots.txt content.

Database-Free: Directly reads from and writes to a file on the filesystem, avoiding database overhead and migrations.

Configurable Path: You can specify the exact location of your robots.txt file in your settings.py for full control.

Dynamic Serving: Includes a view that serves the robots.txt file dynamically, ensuring that any changes made in the admin are live immediately.

Easy Integration: Designed to be a plug-and-play addition to any Django project.

Installation & Setup

Install the package from PyPI:

pip install django-cs-robots

settings.py

Add the app to your INSTALLED_APPS in settings.py. For the admin index page link to appear, place 'cs_robots' before 'django.contrib.admin'. Python

INSTALLED_APPS = [
    'cs_robots',
    'django.contrib.admin',
    # ... other apps
]

Define the absolute path to your robots.txt file

ROBOTS_TXT_PATH = os.path.join(BASE_DIR, 'static', 'robots.txt')

your_project/urls.py

from django.contrib import admin
from django.urls import path, include
from cs_robots.views import serve_robots_txt # Import the serving view

urlpatterns = [
    path('admin/', admin.site.urls),

    # Add the URL for the admin editor
    path('admin/tools/', include('cs_robots.urls')),

    # Add the URL to serve the robots.txt file publicly
    path('robots.txt', serve_robots_txt, name='robots_txt'),

    # ... other project urls
]

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

django_cs_robots-0.1.3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cs_robots-0.1.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file django_cs_robots-0.1.3.tar.gz.

File metadata

  • Download URL: django_cs_robots-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for django_cs_robots-0.1.3.tar.gz
Algorithm Hash digest
SHA256 45b5223f8dd7ac4447c3477e771caa5f2ec9eb4c33be6cf1d06c1a6b5b6af8fa
MD5 79ccce0c5ba5b0b4d1154fb09e3df97a
BLAKE2b-256 44b8002ba55ad22121d32823b5f17a2f2a303bebc2d53bf6b3342f576515e793

See more details on using hashes here.

File details

Details for the file django_cs_robots-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cs_robots-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fbbf10248e5404748db24a5122cb820aca80930175e8aeddd2f2ea955b7163c7
MD5 28b7406c0ce3f6866328b54b1431cb7a
BLAKE2b-256 f26157f27baccbef881caf5350cbf2c15b0e307cb22de962b2222f647cc12bc0

See more details on using hashes here.

Supported by

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