{ "info": { "author": "Waylan Limberg", "author_email": "waylan.limberg@icloud.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Utilities" ], "description": "==========\nRheostatic\n==========\n\n.. default-role:: code\n\nA Static File Server with options.\n\n.. contents:: Table of Contents\n :backlinks: top\n\nFeatures\n========\n\n* A dedicated static file server.\n* Emulates common behaviors of various popular servers (index files,\n extensionless files, index directories, etc.) See `options`_ for specifics.\n* Serves custom error pages.\n* Does not require the server root to be the current working directory.\n* |build| |coverage| |status| |version| |format| |pyversions| |license|\n\n.. |build| image:: https://img.shields.io/travis/waylan/rheostatic/master.svg\n :target: https://travis-ci.org/waylan/rheostatic\n.. |coverage| image:: https://img.shields.io/coveralls/waylan/rheostatic/master.svg\n :target: https://coveralls.io/r/waylan/rheostatic?branch=master\n.. |status| image:: https://img.shields.io/pypi/status/rheostatic.svg\n :target: http://pypi.python.org/pypi/rheostatic\n.. |version| image:: https://img.shields.io/pypi/v/rheostatic.svg\n :target: http://pypi.python.org/pypi/rheostatic\n.. |format| image:: https://img.shields.io/pypi/format/rheostatic.svg\n :target: http://pypi.python.org/pypi/rheostatic#downloads\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/rheostatic.svg\n :target: http://pypi.python.org/pypi/rheostatic\n.. |license| image:: https://img.shields.io/pypi/l/rheostatic.svg\n :target: https://opensource.org/licenses/MIT\n\nOptions\n=======\n\nRheostatic currently supports the following options:\n\nroot\n----\n\nThe local file system directory which the server should use as its \"root\"\ndirectory. Usually represented by ``/`` in the URL (for example\n``http://example.com/``). When ``root`` is set to a relative path, the local\nfilesystem path is resolved as an absolute path relative to the current working\ndirectory. Absolute paths are used as-is.\n\nindex_file\n----------\n\nThe name of the file returned when a directory is requested (a URL ending with a\n``/``). A file by that name must be present in the requested directory. Defaults\nto ``index.html``.\n\nFor example, a request to ``/`` would return the file at ``/index.html`` without\nredirecting the client.\n\ndefault_type\n------------\n\nThe ContentType returned for a file when the type is unknown. Defaults to\n``application/octet-stream``.\n\nencoding\n--------\n\nThe encoding used to read and serve the files. Be sure all your files are saved\nusing the same encoding. Defaults to ``utf-8``.\n\ndirectory_template\n------------------\n\nAn HTML template used to display a directory listing when no index file is\navailable for the requested directory. Defaults to the string defined at\n``utils.directory_template``.\n\ndefault_extension\n-----------------\n\nThe extension to use for extensionless URLs. The requested URL must not end in\nan extension or a slash (``/``). This feature is disabled by default. To enable\nthe feature, set the option to a string which contains both a dot and the\ndesired extension. For example, with the option set to ``.html``, a request to\n``/foo`` would return the file ``/foo.html`` without redirecting the client.\n\nInstallation\n============\n\nTo install Rheostatic run the following command::\n\n pip install https://github.com/waylan/rheostatic/archive/master.zip\n\nNote that this is currently **alpha** software and not yet hosted on PyPI. As\nsuch, the above command downloads the source code from GitHub. Upon a stable\nrelease, the package will become available from PyPI.\n\nDependencies\n------------\n\nRheostatic is a pure Python library with no external dependencies. It should run\nwithout issue on CPython versions 2.7, 3.3, 3.4, and 3.5 as well as `PyPy`_.\n\n.. _PyPy: http://pypy.org/\n\nPreparing your Files\n====================\n\nBefore running the server, you need some files to serve. All files must be in\nthe `root`_ directory and its sub-directories. In fact, an error will occur if a\nfile is requested outside of the ``root`` directory. The ``root`` directory can\nexist anywhere on your filesystem as long as Rheostatic has permission to read\nthe files.\n\nEnsure that all files are saved using the same encoding and that that encoding\nis being used by Rheostatic. See `encoding`_ for details.\n\nA file's ContentType is determined by its file extension. For best results, use\ncommon file extensions for your files. A list of known file extensions and the\nContentType used for each can be found in `rheostatic/utils.py`_.\n\n.. _rheostatic/utils.py: https://github.com/waylan/rheostatic/blob/master/rheostatic/utils.py#L100\n\nIf you would like a file to be served when the client requests a directory (for\nexample ``/``, or ``/path/to/some/dir/``), then that directory needs to contain an\nindex file. Be sure to use the file name for the index file set by the\n`index_file`_ option. The default for most servers (including Rheostatic) is\n``index.html``.\n\nIf a directory does not contain an index file, then Rheostatic will return a\ndirectory listing of all the files in that directory (excluding files with names\nthat start with a dot).\n\nFor custom error pages, include files in the \"root\" directory named\n``.html`` where ```` is the HTTP error code which the error page\ncorresponds to. For example, a file named ``404.html`` would be returned for\n``404`` (Not Found) errors. Supported error codes include ``404`` (Not Found),\nand ``405`` (Method Not Allowed). If a custom error page is not found, then\nRheostatic serves a simple plain-text error page.\n\nUse as a Command Line Tool\n==========================\n\nFrom the root directory of your site, run the command ``rheostatic``::\n\n $ cd /var/www\n $ rheostatic\n Starting server at http://localhost:8000/...\n Serving files from /var/www\n Press ctrl+c to stop.\n\nAlternatively, pass the root directory to the ``rheostatic`` command::\n\n $ rheostatic path/to/root\n Starting server at http://localhost:8000/...\n Serving files from /absolute/path/to/root\n Press ctrl+c to stop.\n\nFor detailed usage instructions and options, run ``rheostatic --help``.\n\nIf the ``rheostatic`` command cannot be found, try running\n``python -m rheostatic`` instead.\n\nUse as a Python Library\n=======================\n\nFor basic usage, import the ``rheostatic.serve`` function, which accepts any and\nall `options`_ as keywords::\n\n from rheostatic import serve\n\n serve(address=('0.0.0.0', 80), root='/some/path', default_type='text/plain')\n\nNote that ``address`` expects a tuple of the ``host`` and ``port``. The ``host``\nmust be a string and the ``port`` an integer. All other keywords correspond to\nthe available `options`_.\n\nUnder the hood, the ``serve`` function creates an instance of the class\n``rheostatic.base.Rheostatic`` and passes it to a simple wsgi server as a wsgi\napplication. For lower level usage, an instance of the class may be created and\npassed to any wsgi server. When initializing the class, you may pass in any\n`options`_ as keywords::\n\n from rheostatic.base import Rheostatic\n\n app = Rheostatic(root='/some/path', index_file='README.html')\n\n``Rheostatic`` accepts keywords which correspond to any of the available\n`options`_. All options are also stored as attributes on the class instance::\n\n print app.root\n\n\nInfrequently Asked Questions\n============================\n\nWhy Does this Exist?\n--------------------\n\nThe existing solutions have different goals and do not offer the specific set of\nfeatures that I needed. While some libraries could be subclassed to alter the\nbehavior, attempts to provide patches upstream always result in rejection as the\nlibraries generally where intended to serve static *support* files (images, CSS\nfiles, JavaScript, etc), specifically to support dynamic content (cgi, wsgi,\nDjango, etc.). However, I needed to serve a static site; specifically static\nHTML files along with their supporting media files (generated from a static site\ngenerator). I can't trust that the existing solutions will continue to work, as\ntheir goals do not align with my needs.\n\nOn the other hand, other simple servers often don't offer enough features to\nemulate a real server. Thus, Rheostatic was created to offer the flexibility and\nfeatures to meet all of the needs of static site generators.\n\nWhy is is called \"Rheostatic\"?\n------------------------------\n\nI wanted something that accurately conveyed the purpose and function of the\nlibrary/tool. Note that the similar word, \"rheostat\" comes from the Greek\n\"rheos\" (stream) and is `defined`_ as \"[a]n electrical instrument used to\ncontrol a current by varying the resistance.\" Rheostatic doesn't control\ncurrent, but it does control a *stream* of *static* files served to a client,\nwhich can be varied by adjusting the settings. I also liked the name and it\ndoesn't appear to have been used by anyone else.\n\n.. _defined: https://en.oxforddictionaries.com/definition/us/rheostat\n\nCould you add my pet feature?\n-----------------------------\n\nMaybe. If the feature does not add support for dynamic content and it can be\neasily replicated by popular web servers, I may consider it. Naturally, if you\ndo the work it's more likely to get added, than if you wait for me to work on\nsomething I don't care about and/or need.\n\nLicense\n=======\n\nRheostatic is licensed under the `MIT License`_ as defined in `LICENSE`.\n\n.. _MIT License: https://opensource.org/licenses/MIT\n\nChange Log\n==========\n\nVersion 0.0.1 (2016/11/03)\n--------------------------\n\nThe initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/waylan/rheostatic", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "Rheostatic", "package_url": "https://pypi.org/project/Rheostatic/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Rheostatic/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/waylan/rheostatic" }, "release_url": "https://pypi.org/project/Rheostatic/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "A Static File Server with options.", "version": "0.0.1" }, "last_serial": 2441568, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "14eef075d6d0e5216a1802a7939aece9", "sha256": "068695ffa45331b3a2905bf643008040653ae789a966c1ce2bbd57bcd2fd706d" }, "downloads": -1, "filename": "Rheostatic-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14eef075d6d0e5216a1802a7939aece9", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 31372, "upload_time": "2016-11-04T03:10:20", "url": "https://files.pythonhosted.org/packages/4b/b0/617e73708817d0fc6301153f4b13174bdfbb8ad9d7eec481bf939f5c6ebd/Rheostatic-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a383c6cb203ac4361ca9871719ab712c", "sha256": "ccc393eb6430a5113f522d370722a45324f66846d7ca3c27f184111d14fbf498" }, "downloads": -1, "filename": "Rheostatic-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a383c6cb203ac4361ca9871719ab712c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21085, "upload_time": "2016-11-04T03:10:18", "url": "https://files.pythonhosted.org/packages/6e/b3/8736d9debb348694c473ae85eb788520736a5b4c61ffebc69a7fa16ea80f/Rheostatic-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "14eef075d6d0e5216a1802a7939aece9", "sha256": "068695ffa45331b3a2905bf643008040653ae789a966c1ce2bbd57bcd2fd706d" }, "downloads": -1, "filename": "Rheostatic-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14eef075d6d0e5216a1802a7939aece9", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 31372, "upload_time": "2016-11-04T03:10:20", "url": "https://files.pythonhosted.org/packages/4b/b0/617e73708817d0fc6301153f4b13174bdfbb8ad9d7eec481bf939f5c6ebd/Rheostatic-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a383c6cb203ac4361ca9871719ab712c", "sha256": "ccc393eb6430a5113f522d370722a45324f66846d7ca3c27f184111d14fbf498" }, "downloads": -1, "filename": "Rheostatic-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a383c6cb203ac4361ca9871719ab712c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21085, "upload_time": "2016-11-04T03:10:18", "url": "https://files.pythonhosted.org/packages/6e/b3/8736d9debb348694c473ae85eb788520736a5b4c61ffebc69a7fa16ea80f/Rheostatic-0.0.1.tar.gz" } ] }