annotate README.txt @ 21:3ce9fe38f5e1

addendum
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 29 Feb 2012 16:39:50 -0800
parents 1eb5e82605a5
children 41bd126ab77d
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
21
3ce9fe38f5e1 addendum
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
38 going forward. I also borrowed from Paste's ``StaticURLParser`` and
3ce9fe38f5e1 addendum
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
39 ``static.Cling``.
20
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
40
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
41 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
42 used to serve a directory with the
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
43 `wsgiref <http://docs.python.org/library/wsgiref.html>`_ server.
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
44
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
45 Other Projects
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
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
48 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
49 standalone static fileservers available for python:
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
50
21
3ce9fe38f5e1 addendum
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
51 * `static <http://lukearno.com/projects/static/>`_
20
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
52
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
53 * `Paste <http://pythonpaste.org/modules/urlparser.html>`_ ``StaticURLParser``
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 * `SimpleHTTPServer <http://docs.python.org/library/simplehttpserver.html>`_
1eb5e82605a5 * flush out README
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
56
0
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
57 ----
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
58
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
59 Jeff Hammel
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
60
8d31e36f084e initial stubbing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
61 http://k0s.org/hg/FileServer