Skip to content

Instantly share code, notes, and snippets.

@kaidokert
Last active July 14, 2016 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaidokert/30e85c511d569d2f3bc23c0cdb2096b6 to your computer and use it in GitHub Desktop.
Save kaidokert/30e85c511d569d2f3bc23c0cdb2096b6 to your computer and use it in GitHub Desktop.
Low fuss bottle app to serve static
import os
import sys
import bottle
bottle.debug(True)
static_root = os.path.abspath(os.path.dirname(__file__))
@bottle.route('/')
@bottle.route('/<filename>')
def server_static(filename='index.html'):
return bottle.static_file(filename, root=static_root)
bottle.run(host='0.0.0.0', port=sys.argv[1] if len(sys.argv) > 1 else 5000,
reloader=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment