Reputation: 1405
When I start a http server using a command:
python -m SimpleHTTPServer
How can i change the default 404 page?
Upvotes: 5
Views: 2041
Reputation: 369064
With command line, it is impossible.
You should make a script like following:
import BaseHTTPServer
import SimpleHTTPServer
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
error_message_format = '''
custom error message
'''
BaseHTTPServer.test(MyHandler, BaseHTTPServer.HTTPServer)
Upvotes: 4