Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/simplehttpserver.rst

    r2 r391  
    99.. note::
    1010   The :mod:`SimpleHTTPServer` module has been merged into :mod:`http.server` in
    11    Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
    12    converting your sources to 3.0.
     11   Python 3.  The :term:`2to3` tool will automatically adapt imports when
     12   converting your sources to Python 3.
    1313
    1414
     
    8282      ``text/`` the file is opened in text mode; otherwise binary mode is used.
    8383
    84       For example usage, see the implementation of the :func:`test` function.
     84      The :func:`test` function in the :mod:`SimpleHTTPServer` module is an
     85      example which creates a server using the :class:`SimpleHTTPRequestHandler`
     86      as the Handler.
    8587
    8688      .. versionadded:: 2.5
    8789         The ``'Last-Modified'`` header.
    8890
     91
     92The :mod:`SimpleHTTPServer` module can be used in the following manner in order
     93to set up a very basic web server serving files relative to the current
     94directory. ::
     95
     96   import SimpleHTTPServer
     97   import SocketServer
     98
     99   PORT = 8000
     100
     101   Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
     102
     103   httpd = SocketServer.TCPServer(("", PORT), Handler)
     104
     105   print "serving at port", PORT
     106   httpd.serve_forever()
     107
     108The :mod:`SimpleHTTPServer` module can also be invoked directly using the
     109:option:`-m` switch of the interpreter with a ``port number`` argument.
     110Similar to the previous example, this serves the files relative to the
     111current directory. ::
     112
     113   python -m SimpleHTTPServer 8000
    89114
    90115.. seealso::
Note: See TracChangeset for help on using the changeset viewer.