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