django-routify


Namedjango-routify JSON
Version 0.3.3 PyPI version JSON
download
home_pageNone
SummaryDjango-Routify is a package for simple routing Views in the classic Django framework.
upload_time2024-10-11 11:29:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Vitaliy Popel 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-routify django routify django-router django router router for django router routify
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django-Routify
**Django-Routify** is a package for simple routing Views in the classic Django framework.

With Django-Routify package you no longer have to manually register your views in `urlpatterns` using django.urls.path function.

Django-Routify can help you to easily register your views using Router class and his @Router.route(...) decorator.
If you are familiar with Flask, FastAPI or even Django REST Framework, you know that every single view should be registered using decorators.
It is <ins>easy to read</ins> first of all, and <ins>simplified work</ins>.

Also you can set `auto_trailing_slash` to `True` value when you're initializing your Router and can write your url_path similar to Flask, FastAPI etc.
If `auto_trailing_slash` is `True` then url_path which will be equal to `'/hello-world'` will be translated to classic Django url rule - `'hello-world/'`.

Django-Routify is support `function` and `class` based views, and also `asynchronous`.

## Documentation
Documentation are already available [here](https://vitaliypopel.github.io/django-routify-docs/homepage)!

## Requirements
- Python 3.8+
- Django 4.0+

## Installation
To install Django-Routify package use the command below in your environment:

- Using `pip`
```shell
pip install django-routify
```

- Using `Poetry`
```shell
poetry add django-routify
```

## Example
For **extended example** with tests visit [examples/example](https://github.com/vitaliypopel/django-routify/tree/main/examples/example).

### Using Django-Routify with Django

~/project/app/views.py:
```python
from django.http import HttpRequest, HttpResponse

from django_routify import Router

router = Router('/app', 'app', auto_trailing_slash=True)


@router.route('/hello-world', methods=['GET'])
def hello_world(request: HttpRequest) -> HttpResponse:
    return HttpResponse('Hello World!')
```

~/project/app/urls.py:
```python
from django_routify import include_router

from .views import router

urlpatterns = [
    include_router(router),
]
```

### Using classic Django

~/project/app/views.py:
```python
from django.http import HttpRequest, HttpResponse
from django.views.decorators.http import require_http_methods


@require_http_methods(['GET'])
def hello_world(request: HttpRequest) -> HttpResponse:
    return HttpResponse('Hello World!')
```

~/project/app/urls.py:
```python
from django.urls import path, include

from .views import hello_world

app_name = 'app'
urlpatterns = [
    path(
        'app/',
        include(
            [
                path('hello-world/', hello_world, name='hello_world'),
            ]
        ),
    ),
]
```

#### Note:
_The result of these two examples will do the same thing_

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-routify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Vitaliy Popel <popelcompany@gmail.com>",
    "keywords": "django-routify, django routify, django-router, django router, router for django, router, routify",
    "author": null,
    "author_email": "Vitaliy Popel <popelcompany@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3f/73/bd8f85551437f342e7134d3af10e2e0bfe1f6d651ca79b010713acae4811/django_routify-0.3.3.tar.gz",
    "platform": null,
    "description": "# Django-Routify\n**Django-Routify** is a package for simple routing Views in the classic Django framework.\n\nWith Django-Routify package you no longer have to manually register your views in `urlpatterns` using django.urls.path function.\n\nDjango-Routify can help you to easily register your views using Router class and his @Router.route(...) decorator.\nIf you are familiar with Flask, FastAPI or even Django REST Framework, you know that every single view should be registered using decorators.\nIt is <ins>easy to read</ins> first of all, and <ins>simplified work</ins>.\n\nAlso you can set `auto_trailing_slash` to `True` value when you're initializing your Router and can write your url_path similar to Flask, FastAPI etc.\nIf `auto_trailing_slash` is `True` then url_path which will be equal to `'/hello-world'` will be translated to classic Django url rule - `'hello-world/'`.\n\nDjango-Routify is support `function` and `class` based views, and also `asynchronous`.\n\n## Documentation\nDocumentation are already available [here](https://vitaliypopel.github.io/django-routify-docs/homepage)!\n\n## Requirements\n- Python 3.8+\n- Django 4.0+\n\n## Installation\nTo install Django-Routify package use the command below in your environment:\n\n- Using `pip`\n```shell\npip install django-routify\n```\n\n- Using `Poetry`\n```shell\npoetry add django-routify\n```\n\n## Example\nFor **extended example** with tests visit [examples/example](https://github.com/vitaliypopel/django-routify/tree/main/examples/example).\n\n### Using Django-Routify with Django\n\n~/project/app/views.py:\n```python\nfrom django.http import HttpRequest, HttpResponse\n\nfrom django_routify import Router\n\nrouter = Router('/app', 'app', auto_trailing_slash=True)\n\n\n@router.route('/hello-world', methods=['GET'])\ndef hello_world(request: HttpRequest) -> HttpResponse:\n    return HttpResponse('Hello World!')\n```\n\n~/project/app/urls.py:\n```python\nfrom django_routify import include_router\n\nfrom .views import router\n\nurlpatterns = [\n    include_router(router),\n]\n```\n\n### Using classic Django\n\n~/project/app/views.py:\n```python\nfrom django.http import HttpRequest, HttpResponse\nfrom django.views.decorators.http import require_http_methods\n\n\n@require_http_methods(['GET'])\ndef hello_world(request: HttpRequest) -> HttpResponse:\n    return HttpResponse('Hello World!')\n```\n\n~/project/app/urls.py:\n```python\nfrom django.urls import path, include\n\nfrom .views import hello_world\n\napp_name = 'app'\nurlpatterns = [\n    path(\n        'app/',\n        include(\n            [\n                path('hello-world/', hello_world, name='hello_world'),\n            ]\n        ),\n    ),\n]\n```\n\n#### Note:\n_The result of these two examples will do the same thing_\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Vitaliy Popel  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": "Django-Routify is a package for simple routing Views in the classic Django framework.",
    "version": "0.3.3",
    "project_urls": {
        "Bug reports": "https://github.com/vitaliypopel/django-routify/issues",
        "Documentation": "https://vitaliypopel.github.io/django-routify-docs/homepage",
        "Homepage": "https://github.com/vitaliypopel/django-routify",
        "Source": "https://github.com/vitaliypopel/django-routify/"
    },
    "split_keywords": [
        "django-routify",
        " django routify",
        " django-router",
        " django router",
        " router for django",
        " router",
        " routify"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3db34e09b821802fc2bcfb0eec75140cb52ab637d80dadf10a497159740269c4",
                "md5": "50012f7cf5354378e3f5ecaa5f15aa76",
                "sha256": "4ad695b2d5136593461f7960d411571498f4423fe4c3ce8056274563317c499b"
            },
            "downloads": -1,
            "filename": "django_routify-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50012f7cf5354378e3f5ecaa5f15aa76",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9869,
            "upload_time": "2024-10-11T11:29:56",
            "upload_time_iso_8601": "2024-10-11T11:29:56.534069Z",
            "url": "https://files.pythonhosted.org/packages/3d/b3/4e09b821802fc2bcfb0eec75140cb52ab637d80dadf10a497159740269c4/django_routify-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f73bd8f85551437f342e7134d3af10e2e0bfe1f6d651ca79b010713acae4811",
                "md5": "4c7bff7fae1494e89a4a59f278614e49",
                "sha256": "16dbf18c160ab0fa9acdb77ffe3932f0a54217ed75458fbdc51e960cba0a04d3"
            },
            "downloads": -1,
            "filename": "django_routify-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4c7bff7fae1494e89a4a59f278614e49",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9739,
            "upload_time": "2024-10-11T11:29:57",
            "upload_time_iso_8601": "2024-10-11T11:29:57.378155Z",
            "url": "https://files.pythonhosted.org/packages/3f/73/bd8f85551437f342e7134d3af10e2e0bfe1f6d651ca79b010713acae4811/django_routify-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 11:29:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vitaliypopel",
    "github_project": "django-routify",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "django-routify"
}
        
Elapsed time: 0.45718s