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
|
|
36 http://docs.webob.org/en/latest/file-example.html though the example
|
|
37 there is more complete. I will work on making this more thorough
|
21
|
38 going forward. I also borrowed from Paste's ``StaticURLParser`` and
|
|
39 ``static.Cling``.
|
20
|
40
|
|
41 In addition there is a command line script, ``serve``, which may be
|
|
42 used to serve a directory with the
|
|
43 `wsgiref <http://docs.python.org/library/wsgiref.html>`_ server.
|
|
44
|
|
45 Other Projects
|
|
46 --------------
|
|
47
|
|
48 While I didn't find them suitable for my use, there are other
|
|
49 standalone static fileservers available for python:
|
|
50
|
21
|
51 * `static <http://lukearno.com/projects/static/>`_
|
20
|
52
|
|
53 * `Paste <http://pythonpaste.org/modules/urlparser.html>`_ ``StaticURLParser``
|
|
54
|
|
55 * `SimpleHTTPServer <http://docs.python.org/library/simplehttpserver.html>`_
|
|
56
|
0
|
57 ----
|
|
58
|
|
59 Jeff Hammel
|
|
60
|
|
61 http://k0s.org/hg/FileServer
|