django-tsp


Namedjango-tsp JSON
Version 3.14.8 PyPI version JSON
download
home_pagehttps://github.com/TravelSalesmanProblem/django_tsp
Summarydjango-tsp is a django travel salesman problem.
upload_time2023-05-08 14:49:02
maintainerAmirBahador Bahadori
docs_urlNone
authorAmirBahador Bahadori
requires_python>=3.7
licenseMIT
keywords django tsp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django_tsp
django_tsp is a wrapper build on top of the tsp_wrapper

* Provide apis for calling the tsp_wrapper
* Provide django commands for tsp_wrapper
* Provide websocket template for tsp sloutions

## Installation
```bash
pip install django-tsp
```

## Getting started
* Add django_tsp to your install apps
```python
INSTALLED_APPS = [
    'daphne',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django_tsp', # <--- here we added our package
]
```
* fill up the require variables in settings.py
```python
TSP_HOOK_URL="http://django:8000/api/tsp/hook/" # your webhook link
TSP_BROKER_URL = "amqp://guest:guest@rabbitmq:5672/"
```
* install django_channels and use following view in your routing
```python
from django_tsp.routing import ws_urlpatterns


application = ProtocolTypeRouter({
    "http": django_asgi_app,
    "websocket": AuthMiddlewareStack(URLRouter(ws_urlpatterns))
})
```
* use add following apis to your urls.py (needs drf and drf_docs)
```python
from django_tsp.apis import WebhookApi, SolverApi 

urlpatterns = [
    path('tsp/', include(([
        path('solver/', SolverApi.as_view(), name="solver"),
        path('hook/', WebhookApi.as_view(), name="hook"),
    ], "tsp")), ),
]

```
* for the template websocket add following views inside of your urls.py
```python
from django_tsp.views import index
from drf_spectacular.views import (
    SpectacularAPIView,
    SpectacularRedocView,
    SpectacularSwaggerView,
)

urlpatterns = [
    path('', index, name="index"), # the improtant template one
    path("schema/", SpectacularAPIView.as_view(api_version="v1"), name="schema"),
    path("doc/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
    path("redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
]
```

## Usage
* for running the bridge
```
python manage.py bridge
```
* for running the reciver
```
python manage.py reciver
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TravelSalesmanProblem/django_tsp",
    "name": "django-tsp",
    "maintainer": "AmirBahador Bahadori",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "amirbahador.pv@gmail.com",
    "keywords": "django,tsp",
    "author": "AmirBahador Bahadori",
    "author_email": "amirbahador.pv@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/2f/bef8af40d1a417d782055f9a8213e3593256599c589345b87d1e41423254/django_tsp-3.14.8.tar.gz",
    "platform": null,
    "description": "# django_tsp\ndjango_tsp is a wrapper build on top of the tsp_wrapper\n\n* Provide apis for calling the tsp_wrapper\n* Provide django commands for tsp_wrapper\n* Provide websocket template for tsp sloutions\n\n## Installation\n```bash\npip install django-tsp\n```\n\n## Getting started\n* Add django_tsp to your install apps\n```python\nINSTALLED_APPS = [\n    'daphne',\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django_tsp', # <--- here we added our package\n]\n```\n* fill up the require variables in settings.py\n```python\nTSP_HOOK_URL=\"http://django:8000/api/tsp/hook/\" # your webhook link\nTSP_BROKER_URL = \"amqp://guest:guest@rabbitmq:5672/\"\n```\n* install django_channels and use following view in your routing\n```python\nfrom django_tsp.routing import ws_urlpatterns\n\n\napplication = ProtocolTypeRouter({\n    \"http\": django_asgi_app,\n    \"websocket\": AuthMiddlewareStack(URLRouter(ws_urlpatterns))\n})\n```\n* use add following apis to your urls.py (needs drf and drf_docs)\n```python\nfrom django_tsp.apis import WebhookApi, SolverApi \n\nurlpatterns = [\n    path('tsp/', include(([\n        path('solver/', SolverApi.as_view(), name=\"solver\"),\n        path('hook/', WebhookApi.as_view(), name=\"hook\"),\n    ], \"tsp\")), ),\n]\n\n```\n* for the template websocket add following views inside of your urls.py\n```python\nfrom django_tsp.views import index\nfrom drf_spectacular.views import (\n    SpectacularAPIView,\n    SpectacularRedocView,\n    SpectacularSwaggerView,\n)\n\nurlpatterns = [\n    path('', index, name=\"index\"), # the improtant template one\n    path(\"schema/\", SpectacularAPIView.as_view(api_version=\"v1\"), name=\"schema\"),\n    path(\"doc/\", SpectacularSwaggerView.as_view(url_name=\"schema\"), name=\"swagger-ui\"),\n    path(\"redoc/\", SpectacularRedocView.as_view(url_name=\"schema\"), name=\"redoc\"),\n]\n```\n\n## Usage\n* for running the bridge\n```\npython manage.py bridge\n```\n* for running the reciver\n```\npython manage.py reciver\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "django-tsp is a django travel salesman problem.",
    "version": "3.14.8",
    "project_urls": {
        "Homepage": "https://github.com/TravelSalesmanProblem/django_tsp",
        "Twitter": "https://twitter.com/AmirBahadordev"
    },
    "split_keywords": [
        "django",
        "tsp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63c580738d6f1dfe9da0bc86b805a446aa979bc6a138ced933127dda4c78a4be",
                "md5": "0fc3a8366bda3049b8263fd46068c402",
                "sha256": "9fb3880aa0169d9cbfd1ed35f219a4109e6b67307dde9260621e90ee625ef04c"
            },
            "downloads": -1,
            "filename": "django_tsp-3.14.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0fc3a8366bda3049b8263fd46068c402",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12237,
            "upload_time": "2023-05-08T14:48:59",
            "upload_time_iso_8601": "2023-05-08T14:48:59.988125Z",
            "url": "https://files.pythonhosted.org/packages/63/c5/80738d6f1dfe9da0bc86b805a446aa979bc6a138ced933127dda4c78a4be/django_tsp-3.14.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d12fbef8af40d1a417d782055f9a8213e3593256599c589345b87d1e41423254",
                "md5": "2a80c8c64a1bfe76d60296991e7d2ea1",
                "sha256": "c792a6538c0441acea59b0a869d330e69e3150f74c6d037e37c7db5034f3d2b5"
            },
            "downloads": -1,
            "filename": "django_tsp-3.14.8.tar.gz",
            "has_sig": false,
            "md5_digest": "2a80c8c64a1bfe76d60296991e7d2ea1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10737,
            "upload_time": "2023-05-08T14:49:02",
            "upload_time_iso_8601": "2023-05-08T14:49:02.765830Z",
            "url": "https://files.pythonhosted.org/packages/d1/2f/bef8af40d1a417d782055f9a8213e3593256599c589345b87d1e41423254/django_tsp-3.14.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 14:49:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TravelSalesmanProblem",
    "github_project": "django_tsp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "django-tsp"
}
        
Elapsed time: 0.22432s