Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e55a2052
Commit
e55a2052
authored
Jun 16, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue8937 - SimpleHTTPServer should contain usage example
parent
526e5eed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
Doc/library/simplehttpserver.rst
Doc/library/simplehttpserver.rst
+23
-1
No files found.
Doc/library/simplehttpserver.rst
View file @
e55a2052
...
@@ -81,12 +81,34 @@ The :mod:`SimpleHTTPServer` module defines the following class:
...
@@ -81,12 +81,34 @@ The :mod:`SimpleHTTPServer` module defines the following class:
contents of the file are output. If the file's MIME type starts with
contents of the file are output. If the file's MIME type starts with
``text/`` the file is opened in text mode; otherwise binary mode is used.
``text/`` the file is opened in text mode; otherwise binary mode is used.
For example usage, see the implementation of the :func:`test` function.
The :func:`test` function in the :mod:`SimpleHTTPServer` module is an
example which interfaces the :class:`SimpleHTTPRequestHandler` as a
Handler to the :mod:`BaseHTTPServer` module.
.. versionadded:: 2.5
.. versionadded:: 2.5
The ``'Last-Modified'`` header.
The ``'Last-Modified'`` header.
The :mod:`SimpleHTTPServer` module can be used the following manner in order to
setup a very basic web server serving files relative to the current directory.::
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
It can also be invoked directly using the ``-m`` switch of interpreter a with
``port number`` argument.::
python -m SimpleHTTPServer 8000
.. seealso::
.. seealso::
Module :mod:`BaseHTTPServer`
Module :mod:`BaseHTTPServer`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment