annotate README.txt @ 20:1eb5e82605a5

* flush out README * other minor fixes
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 29 Feb 2012 16:38:39 -0800
parents 8d31e36f084e
children 3ce9fe38f5e1
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
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
36 http://docs.webob.org/en/latest/file-example.html though the example
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
37 there is more complete. I will work on making this more thorough
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
38 going forward.
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
39
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
40 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
41 used to serve a directory with the
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
42 `wsgiref <http://docs.python.org/library/wsgiref.html>`_ server.
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
43
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
44 Other Projects
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
45 --------------
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
46
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
47 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
48 standalone static fileservers available for python:
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
49
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
50 * `Cling <http://lukearno.com/projects/static/>`_
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
51
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
52 * `Paste <http://pythonpaste.org/modules/urlparser.html>`_ ``StaticURLParser``
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 * `SimpleHTTPServer <http://docs.python.org/library/simplehttpserver.html>`_
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
55
0
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
56 ----
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
57
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
58 Jeff Hammel
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
59
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
60 http://k0s.org/hg/FileServer