{ "info": { "author": "Jaroslaw Lachowski", "author_email": "jalachowski@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries", "Topic :: Utilities" ], "description": ".. -*- mode: rst; coding: utf-8 -*-\r\n\r\nstatic3 - A really simple WSGI way to serve static (or mixed) content.\r\n====================================================================================\r\n\r\n.. image:: https://travis-ci.org/rmohr/static3.svg?branch=master\r\n :target: https://travis-ci.org/rmohr/static3\r\n\r\n:Authors: Roman Mohr \r\n:Version: 0.5.1\r\n:Date: 2014-06-14\r\n:Code: https://github.com/rmohr/static3\r\n\r\n.. contents:: Table of Contents\r\n :backlinks: top\r\n\r\nThis software is a Python3 compatible fork of Luke Arnos library static_.\r\n\r\nThe library is now Python3 compatible and Genshi_ support (the sucessor of\r\nkid_) is added. On Python2 Genshi and/or kid can be used as template engine. On\r\nPython3 only Genshi is available.\r\n\r\nThis library provides an easy way to include static content\r\nin your WSGI applications. There is a convenience method for serving\r\nfiles located via pkg_resources. There are also facilities for serving\r\nmixed (static and dynamic) content using \"magic\" file handlers.\r\nPython builtin string substitution, kid and Genshi template support are provided\r\nand it is easy to roll your own handlers. Note that this distribution\r\ndoes not require kid or Genshi unless you want to use that type of template. Also\r\nprovides a command of the same name as a convenience when you just want\r\nto share a little content over HTTP, ad hoc.\r\n\r\nInstallation and Usage\r\n----------------------\r\n\r\nLatest release via PIP::\r\n\r\n pip install static3\r\n\r\nInstallation via GitHub::\r\n\r\n git clone https://github.com/rmohr/static3.git\r\n cd static3\r\n pip install .\r\n\r\nCling\r\n^^^^^\r\n\r\n`Cling` serves static content only. Just give it the base directory with your\r\nfiles you want to make accessible. You get a full WSGI app with an example as\r\nsimple as that::\r\n\r\n from static import Cling\r\n from wsgiref.simple_server import make_server\r\n my_app = Cling(\"/my/directory\")\r\n make_server(\"localhost\", 9999, my_app).serve_forever()\r\n\r\nNow you can access everything in the given directory via http://localhost:9999.\r\n\r\nShock\r\n^^^^^\r\n\r\n`Shock` has the same basic functionality like `Cling` but with Shock we can\r\nalso have some templating fun. Shock comes with three templating backends.\r\nString substitution, kid and Genshi. The decision which backend to use is done\r\nby examining the extension of the file to serve. The file extensions are 'stp',\r\n'kid' and 'genshi'. So if you want to provide a file called 'index.html' via\r\nthe kid backend, name your file 'index.html.kid'. A short example might look\r\nlike this::\r\n\r\n from static import Shock, KidMagic\r\n from wsgiref.simple_server import make_server\r\n my_app = Shock(\"/my/directory\", magics=[KidMagic(title=\"Hello World\")])\r\n make_server(\"localhost\", 9999, my_app).serve_forever()\r\n\r\nAnd the example 'index.html.kid'::\r\n\r\n \r\n \r\n \r\n \r\n

$title

\r\n \r\n \r\n\r\nA similar template 'index.html.genshi' for Genshi::\r\n\r\n \r\n \r\n \r\n \r\n

$title

\r\n \r\n \r\n\r\nThis simple application will replace the placeholder `title` with 'Hello World'\r\nin every provided file which ends in '.kid'.\r\nIn this example it already is already obvious, that although different template\r\nengines can be used, they can only be used in a very `static` way. Never the\r\nless `Shock` is perfectly suitable for simple semi-static things like make the\r\nURL to your companies logo, or the company name variable.\r\n\r\nUnicode Support\r\n^^^^^^^^^^^^^^^\r\n\r\nWhen using a template system in Python3 it might be necessary to explicitly\r\nset an encoding for the sites provided. This can be done via the \r\n`encoding` attribute of `Shock`::\r\n\r\n from static import Shock\r\n shock = Shock(\"/var/www/pub\")\r\n shock.encoding=\"latin-1\"\r\n\r\nWhen using `Cling` or `Shock` to serve static content the\r\nencoding need not to be set, as the content is just streamed through.\r\nIf you have templates encoded in different formats, an instance of\r\n`Shock` needs to be instantiated for every codec used.\r\n\r\n.. _static: https://pypi.python.org/pypi/static\r\n.. _kid: https://pypi.python.org/pypi/kid\r\n.. _Genshi: https://pypi.python.org/pypi/Genshi", "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/jlachowski/static3", "keywords": "wsgi web http static content webapps", "license": "LGPL", "maintainer": "", "maintainer_email": "", "name": "static3-jl", "package_url": "https://pypi.org/project/static3-jl/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/static3-jl/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jlachowski/static3" }, "release_url": "https://pypi.org/project/static3-jl/0.6.0/", "requires_dist": null, "requires_python": null, "summary": "A really simple WSGI way to serve static (or mixed) content.", "version": "0.6.0" }, "last_serial": 1188080, "releases": { "0.6.0": [ { "comment_text": "", "digests": { "md5": "b899241da0bb416bdba36ffbcef6aa2f", "sha256": "18c01ff87ef8888978479a7441293e037b7c59ec1d0b8488be3e6023fc304ab2" }, "downloads": -1, "filename": "static3-jl-0.6.0.tar.gz", "has_sig": false, "md5_digest": "b899241da0bb416bdba36ffbcef6aa2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23212, "upload_time": "2014-08-12T16:59:40", "url": "https://files.pythonhosted.org/packages/88/8d/74f06e00477d44afbd30a9b38a6b8ec241d5fc43440c0d1ffc1bb855edeb/static3-jl-0.6.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b899241da0bb416bdba36ffbcef6aa2f", "sha256": "18c01ff87ef8888978479a7441293e037b7c59ec1d0b8488be3e6023fc304ab2" }, "downloads": -1, "filename": "static3-jl-0.6.0.tar.gz", "has_sig": false, "md5_digest": "b899241da0bb416bdba36ffbcef6aa2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23212, "upload_time": "2014-08-12T16:59:40", "url": "https://files.pythonhosted.org/packages/88/8d/74f06e00477d44afbd30a9b38a6b8ec241d5fc43440c0d1ffc1bb855edeb/static3-jl-0.6.0.tar.gz" } ] }