{ "info": { "author": "Benjamin Hicks", "author_email": "benajmin.w.hicks@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "==============\ndjango-giftbox\n==============\n\n.. image:: https://www.travis-ci.org/bwhicks/django-giftbox.svg?branch=master\n :target: https://www.travis-ci.org/bwhicks/django-giftbox\n :alt: Travis-CI badge\n\n.. image:: https://codecov.io/gh/bwhicks/django-giftbox/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/bwhicks/django-giftbox\n :alt: Codecov.io badge\n\n\nDescription\n-----------\n\ndjango-giftbox is an app for the Django web framework that provides an easy\nwrapper for X-Sendfile functionality in Apache.\n\nThis lets users protect files by not allowing them to be downloaded\ndirectly, but allows Django to programmatically send a redirect and let the\nwebserver handle the transaction.\n\nThe current implementation is compatible with Django 1.11+ (tested against LTS\nreleases including 2.2) and py2/3 compatible.\n\nThe only required dependency is Django itself and mod_xsendfile_ installed for \nApache.\n\n.. _mod_xsendfile: https://tn123.org/mod_xsendfile/\n\nInstallation\n------------\n\nYou can simply download from PyPi using pip::\n\n pip install django-giftbox\n\nTo install extra ``python-magic`` functionality::\n\n pip install django-giftbox[magic]\n\nYou'll need to have ``libmagic`` (or ``libmagic-dev`` on many Linux distributions) \ninstalled to use this, otherwise ``python-magic`` will break.\n\nOr feel free to clone from the ``master`` branch::\n\n pip install git+https://github.com/bwhicks/django-giftbox.git@master#egg=giftbox\n\nThat's it.\n\nConfiguration\n-------------\n\nThere are two 'modes' for giftbox. One of them is ``dev``, and this is the\ndefault when running using the Django development server. Giftbox should auto-detect\nthis and run accordingly.\n\nThe other is ``prod``, which assumes you are routing your Django appplication through\na web server like Apache\n\nIn Django ``settings.py``, define a dictionary called ``GIFTBOX_SETTINGS``.\nYou must define ``doc_root``, which is the directory\nwhere the files you wish t\nUsageo serve via Giftbox are located. This can be a relative\npath under your vhost's doc root or an absolute file path.\n\nYou can also specify these at run time, but you must least have ``GIFTBOX_SETTINGS``\nwith some sane defaults for one of those settings::\n\n GIFTBOX_SETTINGS = {\n 'type': 'prod', # will still detect dev server locally\n 'doc_root': '/path/to/protected/files',\n }\n\nA corresponding Apache entry in a Vhost or other configuration would be::\n\n XSendFile on\n XSendFilePath /path/to/protected/files\n\nThe major advantage of this is that you can block regular access to this path\nor leave it out of Apache's docroot.\n\n\nOptional python-magic\n=====================\n\nIf ``libmagic`` and ``python-magic`` are installed, Giftbox will set the\n``Content-Type`` header when passing information to your HTTP server. If you\ndon't want this functionality (serving many files quickly or large ones), you can\ndisable it and your HTTP server's mime handling will apply::\n\n GIFTBOX_SETTINGS = {\n # other settings...\n 'use_magic': False,\n }\n\n\n=====\n\nIn a view or view function, create an instance as follows::\n\n from gitfbox import GiftBox\n\n def my_view_func(request):\n box = GiftBox(request)\n return box.send('filename')\n\n\n``box`` in this case is an instance of ``GiftBox``, which can have its ``self.kwargs``\ndict modified in any way, as well as having ``kwargs`` passed via its constructor.\nBy default it looks to ``settings.py`` for its defaults.\n\n``box.send()`` returns an instance of ``django.httpd.HttpReponse``\n(or ``FileResponse``) with\nappropriate headers set and ``Content-Type`` cleared so that your web server\ncan use its own MIME handling to set the type appropriately (unless you use\nthe optional ``python-magic`` functionality). You can manually\nspecify this before returning the ``HttpResponse`` object, too.\n\nAll of this depends on a correct server setup for Apache that\nproperly creates a protected url that allows sendfile type requests.\n\nThe object allows flexible settings of virtually every kwarg at any point. If\nyou need to set the `doc_root`` dynamically, either when you\ninstantiate the box or when you call ``Giftbox.send()``, you can do that.\n\nTests\n=====\n\nAll tests can be run using ``tox`` or ``python setup.py pytest``.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bwhicks/django-giftbox", "keywords": "sendfile,apache", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-giftbox", "package_url": "https://pypi.org/project/django-giftbox/", "platform": "", "project_url": "https://pypi.org/project/django-giftbox/", "project_urls": { "Homepage": "https://github.com/bwhicks/django-giftbox" }, "release_url": "https://pypi.org/project/django-giftbox/0.1.1/", "requires_dist": [ "django (>=1.8)", "pytest; extra == 'develop'", "pytest-django; extra == 'develop'", "pytest-cov; extra == 'develop'", "mock; extra == 'develop'", "python-magic; extra == 'develop'", "tox; extra == 'develop'", "tox-travis; extra == 'develop'", "twine; extra == 'develop'", "python-magic; extra == 'magic'", "pytest; extra == 'test'", "pytest-django; extra == 'test'", "pytest-cov; extra == 'test'", "mock; extra == 'test'", "python-magic; extra == 'test'", "tox; extra == 'test'", "tox-travis; extra == 'test'" ], "requires_python": "", "summary": "A package that includes xsendfile capabilities for Django", "version": "0.1.1" }, "last_serial": 5580547, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "37480071cb398f6a253de389ae49f67d", "sha256": "4f805f7daeee4bf277c58e50c23295a9b358a8df8d7ae0cbe4722620e35a3836" }, "downloads": -1, "filename": "django_giftbox-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "37480071cb398f6a253de389ae49f67d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10551, "upload_time": "2019-07-25T00:29:00", "url": "https://files.pythonhosted.org/packages/f5/32/6840b96ec307c96d453826d6afbebb592fcfaae914895d6c0a2200774b6f/django_giftbox-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aae2176c8038cb93d03ea497782ba896", "sha256": "0f590edd2fdbbc02ede0867e0fe5c5c84806611e75c15f5bc914f8844f1e7bf1" }, "downloads": -1, "filename": "django-giftbox-0.1.tar.gz", "has_sig": false, "md5_digest": "aae2176c8038cb93d03ea497782ba896", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6848, "upload_time": "2019-07-25T00:29:03", "url": "https://files.pythonhosted.org/packages/c6/f1/0906ceb3dfb55f2ad29be04919ec3eef596c3f9cadbf0363f8551ff861ad/django-giftbox-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a3ff9dc3e53071cd85db1cacb6674f39", "sha256": "cdd8ea2b8de95eaf26e75251bfe5b303cdd2117b4ccf1db53e56a7a447ee211b" }, "downloads": -1, "filename": "django_giftbox-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a3ff9dc3e53071cd85db1cacb6674f39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10708, "upload_time": "2019-07-25T00:35:11", "url": "https://files.pythonhosted.org/packages/fa/7b/ba12fcfa9a8ea3285235881ca62494b3923673ae0f059e5036560cd69d24/django_giftbox-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "74141d6de405eb9a400bd94319ccf7dc", "sha256": "dd3243e43e1d082d450721f44363bb699f93eadf76423f5aea8cb0cf73afc088" }, "downloads": -1, "filename": "django-giftbox-0.1.1.tar.gz", "has_sig": false, "md5_digest": "74141d6de405eb9a400bd94319ccf7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6955, "upload_time": "2019-07-25T00:35:13", "url": "https://files.pythonhosted.org/packages/de/74/f3258fe5827ef9574ba4e8964d37d13379d611273d0868990a1b472b8f40/django-giftbox-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a3ff9dc3e53071cd85db1cacb6674f39", "sha256": "cdd8ea2b8de95eaf26e75251bfe5b303cdd2117b4ccf1db53e56a7a447ee211b" }, "downloads": -1, "filename": "django_giftbox-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a3ff9dc3e53071cd85db1cacb6674f39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10708, "upload_time": "2019-07-25T00:35:11", "url": "https://files.pythonhosted.org/packages/fa/7b/ba12fcfa9a8ea3285235881ca62494b3923673ae0f059e5036560cd69d24/django_giftbox-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "74141d6de405eb9a400bd94319ccf7dc", "sha256": "dd3243e43e1d082d450721f44363bb699f93eadf76423f5aea8cb0cf73afc088" }, "downloads": -1, "filename": "django-giftbox-0.1.1.tar.gz", "has_sig": false, "md5_digest": "74141d6de405eb9a400bd94319ccf7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6955, "upload_time": "2019-07-25T00:35:13", "url": "https://files.pythonhosted.org/packages/de/74/f3258fe5827ef9574ba4e8964d37d13379d611273d0868990a1b472b8f40/django-giftbox-0.1.1.tar.gz" } ] }