{ "info": { "author": "Peter Baumgartner", "author_email": "pete@lincolnloop.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# django-alive \ud83d\udd7a\n\n[![tests](https://img.shields.io/travis/lincolnloop/django-alive/master.svg)](https://travis-ci.org/lincolnloop/django-alive)\n[![coverage](https://img.shields.io/codacy/coverage/5d539d4956a44f55aec632f3a43ee6c1.svg)](https://app.codacy.com/project/ipmb/django-alive/dashboard)\n[![PyPI](https://img.shields.io/pypi/v/django-alive.svg)](https://pypi.org/project/django-alive/)\n![Python Versions](https://img.shields.io/pypi/pyversions/django-alive.svg)\n\nProvides two healthcheck endpoints for your Django application:\n\n### Alive\n\nVerifies the WSGI server is responding.\n\n* Default URL: `/-/alive/`\n* Success:\n * status code: `200`\n * content: `ok`\n* Failure: This view never returns a failure. A failure would mean your WSGI server is not running.\n\n### Health\n\nVerifies services are ready.\n\n* Default URL: `/-/health/`\n* Success:\n * status_code: `200`\n * content: `{\"healthy\": true}`\n* Failure:\n * status_code: `503`\n * content: `{\"healthy\": false, \"errors\": [\"error 1\", \"error 2\"]}`\n\nBy default the health endpoint will test the database connection, but can be configured to check the cache, staticfiles, or any additional custom checks.\n\nSupports Django 1.10+ on both Python 2 & 3.\n\n## Install\n\n```\npip install django-alive\n```\n\n## Configure\n\nAdd this to your project's `urlpatterns`:\n\n```python\npath(\"-/\", include(\"django_alive.urls\"))\n```\n\nFor versions before Django 2.0, use:\n\n```python\nurl(r\"-/\", include(\"django_alive.urls\"))\n```\n\n## Enabling Checks\n\nThe default \"health\" endpoint will test a simple `SELECT 1` query on the database. Additional checks can be enabled in your Django settings.\n\nUse the `ALIVE_CHECKS` setting to configure the checks to include. It is a dictionary with the path to a Python function as a key and any keyword arguments to pass to that function as a value. A full example:\n\n```python\nALIVE_CHECKS = {\n \"django_alive.checks.check_database\": {},\n \"django_alive.checks.check_staticfile\": {\n \"filename\": \"img/favicon.ico\",\n },\n \"django_alive.checks.check_cache\": {\n \"cache\": \"session\",\n \"key\": \"test123\",\n },\n}\n\n```\n\n## Custom Checks\n\n`django-alive` is designed to easily extend with your own custom checks. Simply define a function which performs your check and raises a `django_alive.HealthcheckFailure` exception in the event of a failure. See [`checks.py`](https://github.com/lincolnloop/django-alive/blob/master/django_alive/checks.py) for some examples on how to write a check.\n\n## Disabling `ALLOWED_HOSTS` for Healthchecks\n\nOften, load balancers will not pass a `Host` header when probing a healthcheck endpoint. This presents a problem for [Django's host header validation](https://docs.djangoproject.com/en/2.1/topics/security/#host-headers-virtual-hosting). A middleware is included that will turn off the host checking only for the healthcheck endpoints. This is safe since these views never do anything with the `Host` header.\n\nEnable the middleware by inserting this **at the beginning** of your `MIDDLEWARE`:\n\n```python\nMIDDLEWARE = [\n \"django_alive.middleware.healthcheck_bypass_host_check\",\n # ...\n]\n```\n\n## Handling `SECURE_SSL_REDIRECT`\n\nIf your load balancer is doing HTTPS termination and you have `SECURE_SSL_REDIRECT=True` in your settings, you want to make sure that your healtcheck URLs are not also redirected to HTTPS. In that case, add the following to your settings:\n\n```python\nSECURE_REDIRECT_EXEMPT = [r\"^-/\"] # django-alive URLs\n```\n\n1.0.1 (2018-09-10)\n------------------\n\n* Documentation improvements\n* Python 3.7 support\n\n\n1.0.0 (2018-08-21)\n------------------\n\n* Initial release", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lincolnloop/django-alive/", "keywords": "django,healtcheck,alive", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-alive", "package_url": "https://pypi.org/project/django-alive/", "platform": "", "project_url": "https://pypi.org/project/django-alive/", "project_urls": { "Homepage": "https://github.com/lincolnloop/django-alive/" }, "release_url": "https://pypi.org/project/django-alive/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Healtchecks for Django", "version": "1.0.1" }, "last_serial": 4258307, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "644788918b0ebc9b9f1548703ba4ef6e", "sha256": "3f281b7e9ff93598ce9b1af46012a34372845a9e0c6c3cb49981cadf06a09d18" }, "downloads": -1, "filename": "django_alive-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "644788918b0ebc9b9f1548703ba4ef6e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7381, "upload_time": "2018-08-22T06:08:20", "url": "https://files.pythonhosted.org/packages/5a/b0/a82b06b005ea2322df79baf13fcc73ff4027fecfc2a67b08683a04b91bae/django_alive-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61c71e93653699c13bd43edb09a77d51", "sha256": "72d9e12e62add240b440bc366b1b7eb871d8a3637817de8e7bbdc27db9751992" }, "downloads": -1, "filename": "django-alive-1.0.0.tar.gz", "has_sig": false, "md5_digest": "61c71e93653699c13bd43edb09a77d51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5139, "upload_time": "2018-08-22T06:08:19", "url": "https://files.pythonhosted.org/packages/62/25/8fba65bedd2600141b9dcec94fc53e81425f5b787d03ce11474e35f5f584/django-alive-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0742d104be61d144a5bf549aaed44177", "sha256": "736101cb61079390af6fcef6541ccd2dab2d9cbf7a63cf50fec9d81c2c879152" }, "downloads": -1, "filename": "django_alive-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0742d104be61d144a5bf549aaed44177", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7575, "upload_time": "2018-09-10T16:21:14", "url": "https://files.pythonhosted.org/packages/8e/d3/ab93e51c502ecf68fdd5a295727b39cb4ca832e780342b77dd061779e7f4/django_alive-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c60fbbd73ada08c97c03f970d44b9d2", "sha256": "38627f71d08fa096fbb7a95932af16af3996681147d2af29af0acbe94bc71288" }, "downloads": -1, "filename": "django-alive-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2c60fbbd73ada08c97c03f970d44b9d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5364, "upload_time": "2018-09-10T16:21:13", "url": "https://files.pythonhosted.org/packages/d8/54/dc452b28b2d422dec848ad7163c9a6040c7a7121db17590f5e4f25e6be36/django-alive-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0742d104be61d144a5bf549aaed44177", "sha256": "736101cb61079390af6fcef6541ccd2dab2d9cbf7a63cf50fec9d81c2c879152" }, "downloads": -1, "filename": "django_alive-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0742d104be61d144a5bf549aaed44177", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7575, "upload_time": "2018-09-10T16:21:14", "url": "https://files.pythonhosted.org/packages/8e/d3/ab93e51c502ecf68fdd5a295727b39cb4ca832e780342b77dd061779e7f4/django_alive-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c60fbbd73ada08c97c03f970d44b9d2", "sha256": "38627f71d08fa096fbb7a95932af16af3996681147d2af29af0acbe94bc71288" }, "downloads": -1, "filename": "django-alive-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2c60fbbd73ada08c97c03f970d44b9d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5364, "upload_time": "2018-09-10T16:21:13", "url": "https://files.pythonhosted.org/packages/d8/54/dc452b28b2d422dec848ad7163c9a6040c7a7121db17590f5e4f25e6be36/django-alive-1.0.1.tar.gz" } ] }