Metadata-Version: 2.4
Name: django-cs-robots
Version: 1.0.3
Summary: A django app to change robots.txt from the admin panel without using the database.
Author-email: Jatsu Argarate <jargarae@codesyntax.com>
License: MIT License
        
        Copyright (c) 2025 CodeSyntax
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/jatsu/django-cs-robots
Project-URL: Issues, https://github.com/jatsu/django-cs-robots/issues
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=3.2
Dynamic: license-file

[![Test Status](https://github.com/codesyntax/django-cs-robots/workflows/Test/badge.svg)](https://github.com/codesyntax/django-cs-robots/actions)
[![PyPI Version](https://img.shields.io/pypi/v/django-cs-robots.svg)](https://pypi.python.org/pypi/django-cs-robots)

# 🤖 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:

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

```python
# 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.

```python
# 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!
