Skip to content

Instantly share code, notes, and snippets.

@DavidLGoldberg
Created March 31, 2012 05:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidLGoldberg/2259618 to your computer and use it in GitHub Desktop.
Save DavidLGoldberg/2259618 to your computer and use it in GitHub Desktop.
Serve up static content in heroku's public folder
import os
from flask import Flask
from werkzeug import SharedDataMiddleware
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__,
static_folder=os.path.join(PROJECT_ROOT, 'public'),
static_url_path='/public')
app.wsgi_app = SharedDataMiddleware(app.wsgi_app,
{'/': os.path.join(os.path.dirname(__file__), 'public') })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment