Commits

Matt Goodall committed a996daf

Make "serve" action's hostname configurable.

Sometimes 'localhost' binds to an ipv6 interface (and causes some browsers
problems) but it's also useful to bind to a public interface for testing with
other browsers.

Comments (0)

Files changed (1)

blatter/__init__.py

         print "Try it out with 'blatter serve' and 'blatter blat'."
     print "Done."
 
-def action_serve(port=('p', 8008), use_reloader=True, debugger=True):
+def action_serve(port=('p', 8008), hostname=('h', 'localhost'),
+                 use_reloader=True, debugger=True):
     """Start a local web server for content viewing."""
     from werkzeug import serving
 
     app = top_level_factory(config, debugger=debugger)
 
     if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
-        print "Blatter server starting for:\n\thttp://localhost:%s%s\n" % (
-            port, config.url_prefix)
-    serving.run_simple('localhost', port, app, use_reloader)
+        print "Blatter server starting for:\n\thttp://%s:%s%s\n" % (
+            hostname, port, config.url_prefix)
+    serving.run_simple(hostname, port, app, use_reloader)
 
 def action_generate(verbose=('v', False)):
     """Process all content in the site folder and place in the output folder."""