A Python SimpleHTTPServer, but serves 404.html if a page is not found.
Project description
SimpleHTTP404Server: Easy testing of 404.html
SimpleHTTP404Server allows easy testing of static HTML providers that allow 404 response customization via a 404.html page. This includes at least GitHub and FastMail. It is a simple extension to SimpleHTTPServer, a built-in Python module which servers the current directory over HTTP.
If you server a static site using GitHub Pages or another static website provider, this module can help you test your 404 page before pushing changes to a live website.
First install the package using pip:
pip install SimpleHTTP404Server
Browse to the directory, and run the following to server it on port 8000.
python -m SimpleHTTP404Server
Or, if you’d like to specify a different port:
python -m SimpleHTTP404Server 1234
And that’s it! Now browse to a page that exists, maybe http://localhost:8000/index.html. And check that your 404.html page is properly loaded by checking a few different paths: * http://localhost:8000/404.html * http://localhost:8000/does-not-exist.html * http://localhost:8000/does/not/exist.html
Usecases
Personally this is used to test any GitHub Pages sites I use, in particular my blog, which is build on Pelican. This is done via Fabric:
@task
def serve():
"""Locally serve the blog."""
local('cd {deploy_path} && python -m SimpleHTTP404Server {listen_port}'.format(**env))
Future
Please let me know (by filing issues or pull requests) if you find any bugs or if you feel there are features missing.
v0.1.2: May 13, 2015
Package readme, changelog.
v0.1.1: May 13, 2015
Supports packaged version uploaded to pypi.
v0.1.0: Feb. 24, 2015
Initial version, supports loading 404.html page from any subdirectory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for SimpleHTTP404Server-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c3577490d818e4a7aa377419e6ba20d09ea6c11770b7899382dd074fe03544d |
|
MD5 | 5b816fc233f39e2806258c33b1891d1a |
|
BLAKE2b-256 | dc7ea9da5f0b5d7fe7fa1454d9939629bc585c248a79c5205dc59d3d2a4b7e37 |
Hashes for SimpleHTTP404Server-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2186b78d120541683bebbb00e5a443a2c8a49e021ac28401c63f4d27e40df9fd |
|
MD5 | 46ba1ad29b2e63fe492e4e499772fbba |
|
BLAKE2b-256 | d0d86df44af83175c368414c2222c75f4ec4df4eff762d51dc6c367224adb8b9 |