Commits

Jason R. Coombs  committed e501f70

Adding serve-local command

  • Participants
  • Parent commits 8484dde
  • Tags 1.5

Comments (0)

Files changed (3)

 1.5
 ~~~
 
-* Adding simple script for creating a directory index (used for legacy
+* Added simple script for creating a directory index (used for legacy
   support).
+* Added command script "serve-local" which uses cherrypy to serve the
+  current directory on port 8080.
 
 1.4
 ~~~

File jaraco/net/http/static.py

+import cherrypy
+import os
+
+def serve_local():
+	"""
+	Serve the current directory as static files.
+	"""
+	config = {
+		'global': {
+			'server.socket_host': '::0',
+		},
+		'/': {
+			'tools.staticdir.root': os.getcwd(),
+			'tools.staticdir.on': 'true',
+			'tools.staticdir.dir': '.',
+		},
+	}
+	cherrypy.quickstart(None, config=config)
 			'fake-http = jaraco.net.http:start_simple_server',
 			'fake-http-auth = jaraco.net.http:auth_request_server',
 			'wget = jaraco.net.http:wget',
+			'serve-local = jaraco.net.http.static:serve_local',
 			'fake-smtp = jaraco.net.smtp:start_simple_server',
 			'udp-send = jaraco.net.udp:Sender',
 			'udp-echo = jaraco.net.udp:EchoServer',