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