django-env-robots


Namedjango-env-robots JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryControl robots.txt files from environment variables and templates.
upload_time2024-06-03 13:43:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Cursive 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.
keywords django robots.txt environment
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Env Robots (.txt)

Serve different robots.txt from your production | stage | etc servers by setting environment variables.
Rules are managed via templates.
By default it excludes robots entirely.


## Installation

Install from [PyPI](https://pypi.org/project/django-env-robots/):

```
pip install django-env-robots
```

Then add the following to your project's `INSTALLED_APPS`.

```
'django_env_robots',
```

## Usage

### settings.py
Set the following:
 - `SERVER_ENV` identifies the nature of the server and thus the robots.txt template that will be used.

E.g:
```
SERVER_ENV = 'production'
```

### urls.py
```
from django_env_robots import urls as robots_urls
...
urlpatterns = [
    path("robots.txt", include(robots_urls)),
]
```

### robots templates
Create corresponding template files for each SERVER_ENV you will be using.
These live in your projects `templates` directory in a `robots` subfolder.

For example, if `SERVER_ENV` can be `production` or `stage`, then create:
 - `templates/robots/production.txt`
 - `templates/robots/stage.txt`

e.g:
```
User-agent: *
Disallow: /admin/

Sitemap: https://www.example.com/sitemap.xml
Sitemap: https://www2.example.com/sitemap.xml
```

### Other considertions

A robots.txt being served from a Whitenose public directory will win over this app. That is because of whitenoise's middleware behaviour - quite correct but watch out for that.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-env-robots",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "django, robots.txt, environment",
    "author": null,
    "author_email": "Pat Smith <pat.smith@cursive.works>",
    "download_url": "https://files.pythonhosted.org/packages/67/b6/24b3f6118a20d06e3ebc060187290b04d0cc16165e0de04b57858180fe8e/django_env_robots-0.0.5.tar.gz",
    "platform": null,
    "description": "# Django Env Robots (.txt)\n\nServe different robots.txt from your production | stage | etc servers by setting environment variables.\nRules are managed via templates.\nBy default it excludes robots entirely.\n\n\n## Installation\n\nInstall from [PyPI](https://pypi.org/project/django-env-robots/):\n\n```\npip install django-env-robots\n```\n\nThen add the following to your project's `INSTALLED_APPS`.\n\n```\n'django_env_robots',\n```\n\n## Usage\n\n### settings.py\nSet the following:\n - `SERVER_ENV` identifies the nature of the server and thus the robots.txt template that will be used.\n\nE.g:\n```\nSERVER_ENV = 'production'\n```\n\n### urls.py\n```\nfrom django_env_robots import urls as robots_urls\n...\nurlpatterns = [\n    path(\"robots.txt\", include(robots_urls)),\n]\n```\n\n### robots templates\nCreate corresponding template files for each SERVER_ENV you will be using.\nThese live in your projects `templates` directory in a `robots` subfolder.\n\nFor example, if `SERVER_ENV` can be `production` or `stage`, then create:\n - `templates/robots/production.txt`\n - `templates/robots/stage.txt`\n\ne.g:\n```\nUser-agent: *\nDisallow: /admin/\n\nSitemap: https://www.example.com/sitemap.xml\nSitemap: https://www2.example.com/sitemap.xml\n```\n\n### Other considertions\n\nA robots.txt being served from a Whitenose public directory will win over this app. That is because of whitenoise's middleware behaviour - quite correct but watch out for that.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Cursive  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. ",
    "summary": "Control robots.txt files from environment variables and templates.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/cursive-works/django-env-robots"
    },
    "split_keywords": [
        "django",
        " robots.txt",
        " environment"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5e8025fb002b19faa56aad69553c9907166e78cefebcbe52c33881d06b1f0e0",
                "md5": "9f6e7c425c6f2b89e81ab51c5878170d",
                "sha256": "dc8ff6418197ee64c43b7062a1d8fc0045a7cd161e90056f2145661507a9b2f6"
            },
            "downloads": -1,
            "filename": "django_env_robots-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f6e7c425c6f2b89e81ab51c5878170d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5354,
            "upload_time": "2024-06-03T13:43:09",
            "upload_time_iso_8601": "2024-06-03T13:43:09.574246Z",
            "url": "https://files.pythonhosted.org/packages/f5/e8/025fb002b19faa56aad69553c9907166e78cefebcbe52c33881d06b1f0e0/django_env_robots-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67b624b3f6118a20d06e3ebc060187290b04d0cc16165e0de04b57858180fe8e",
                "md5": "ac0b1f45205b20d5ee5d7e3547d1e7a0",
                "sha256": "a7755a95b342bfd44f981629bbc6d95a5bc88e2d4676308c8a443982628d9f51"
            },
            "downloads": -1,
            "filename": "django_env_robots-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ac0b1f45205b20d5ee5d7e3547d1e7a0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 4959,
            "upload_time": "2024-06-03T13:43:10",
            "upload_time_iso_8601": "2024-06-03T13:43:10.584796Z",
            "url": "https://files.pythonhosted.org/packages/67/b6/24b3f6118a20d06e3ebc060187290b04d0cc16165e0de04b57858180fe8e/django_env_robots-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-03 13:43:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cursive-works",
    "github_project": "django-env-robots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-env-robots"
}
        
Elapsed time: 0.28213s