Mercurial > hg > FileServer
annotate README.txt @ 34:aca8cb6bfd63 default tip
fix documentation + bump version
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Mon, 05 Mar 2012 14:09:43 -0800 |
| parents | 41bd126ab77d |
| children |
| rev | line source |
|---|---|
| 0 | 1 FileServer |
| 2 =========== | |
| 3 | |
| 4 a simple static fileserver and directory index server in python (WSGI app) | |
| 5 | |
| 20 | 6 About |
| 7 ----- | |
| 8 | |
| 9 Often for testing you will want a static fileserver and directory | |
| 10 index as part of your WSGI stack. In addition, you may have | |
| 11 requirements to run such as part of a production WSGI | |
| 12 stack. FileServer fits these needs. | |
| 13 | |
| 14 Motivation | |
| 15 ---------- | |
| 16 | |
| 17 I needed a directory index server a la Apache to test a PyPI clone I | |
| 18 was using. After surveying what was out there, there didn't seem | |
| 19 anything out there that was easily consumable for my purposes. So I | |
| 20 wrote one only depending on | |
| 21 `webob <http://www.webob.org/>`_ . | |
| 22 | |
| 23 Contents | |
| 24 -------- | |
| 25 | |
| 26 ``from fileserver import *`` should give you access to all of the | |
| 27 usable components of fileserver: | |
| 28 | |
| 29 * ``file_response``: return a webob response object appropriate to a | |
| 30 file name | |
| 31 * ``FileApp``: WSGI app that wraps ``file_response`` | |
| 32 * ``Directory Server``: serves a directory tree and generated indices | |
| 33 * ``main``: command line entry point | |
| 34 | |
| 35 ``FileApp`` and ``file_response`` are heavily borrowed from | |
|
34
aca8cb6bfd63
fix documentation + bump version
Jeff Hammel <jhammel@mozilla.com>
parents:
27
diff
changeset
|
36 http://docs.webob.org/en/latest/file-example.html . |
|
aca8cb6bfd63
fix documentation + bump version
Jeff Hammel <jhammel@mozilla.com>
parents:
27
diff
changeset
|
37 I also borrowed from Paste's ``StaticURLParser`` and ``static.Cling``. |
| 20 | 38 |
| 39 In addition there is a command line script, ``serve``, which may be | |
| 40 used to serve a directory with the | |
| 41 `wsgiref <http://docs.python.org/library/wsgiref.html>`_ server. | |
| 42 | |
| 27 | 43 Tests |
| 44 ----- | |
| 45 | |
| 46 doctests and a test runner, ``test.py``, exist in the ``tests/`` | |
| 47 subdirectory of http://k0s.org/hg/FileServer . I currently use | |
| 48 ``paste.fixture.TestApp`` to mock requests and inspect responses, but | |
| 49 should probably move to | |
| 50 `WebTest <http://webtest.pythonpaste.org/en/latest/index.html>`_ . | |
| 51 | |
| 20 | 52 Other Projects |
| 53 -------------- | |
| 54 | |
| 55 While I didn't find them suitable for my use, there are other | |
| 56 standalone static fileservers available for python: | |
| 57 | |
| 21 | 58 * `static <http://lukearno.com/projects/static/>`_ |
| 20 | 59 |
| 60 * `Paste <http://pythonpaste.org/modules/urlparser.html>`_ ``StaticURLParser`` | |
| 61 | |
| 62 * `SimpleHTTPServer <http://docs.python.org/library/simplehttpserver.html>`_ | |
| 63 | |
| 0 | 64 ---- |
| 65 | |
| 66 Jeff Hammel | |
| 67 | |
| 68 http://k0s.org/hg/FileServer |
