Skip to content

Instantly share code, notes, and snippets.

@andik
Created March 18, 2015 15:38
Show Gist options
  • Save andik/a54eea12ef5c5a315291 to your computer and use it in GitHub Desktop.
Save andik/a54eea12ef5c5a315291 to your computer and use it in GitHub Desktop.
serve static files from flask
from flask import Flask, request, send_from_directory
# set the project root directory as the static folder, you can set others.
app = Flask(__name__, static_url_path='')
@app.route('/js/<path:path>')
def send_js(path):
return send_from_directory('js', path)
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment