Skip to main content

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

Project description

Test Status PyPI Version

🤖 Django CS Robots

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

✨ Introduction

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

1. Installation

Install the package from PyPI:

pip install django-cs-robots

2. settings.py Configuration

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'.

# settings.py
import os

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

# Define the absolute path to your robots.txt file
# (e.g., inside your project's static directory)
ROBOTS_TXT_PATH = os.path.join(BASE_DIR, 'static', 'robots.txt')

3. URL Configuration

Add the cs_robots paths to your project's urls.py.

# 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),

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

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

    # ... other project urls
]

💖 Contributions

Bug reports and feature requests are welcome!

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-1.0.0.tar.gz (9.8 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-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_cs_robots-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_cs_robots-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e1fb0655d11d0cbd20b5566b33285a47231cb94d4f4c99f9e43adf4f12a53c20
MD5 85a754b4db0d6852e98ad5adaffa64b3
BLAKE2b-256 e60d0835706eee55fb81269bf2a258a2556c620b35b09766243a849b03b66a2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cs_robots-1.0.0.tar.gz:

Publisher: python-publish.yml on codesyntax/django-cs-robots

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for django_cs_robots-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59508794d72ca445b448c790845c138d6bc3a265ab2a879ff341fe4c8cb8d840
MD5 420e5108669e0ac11d8fc8787098277f
BLAKE2b-256 44fa13a9b61f1cb1249f08962adef6115404a80f4f96fb3575d41d9926baed7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cs_robots-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on codesyntax/django-cs-robots

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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