Skip to content

Instantly share code, notes, and snippets.

@pearkes
Created February 19, 2012 16:35
Show Gist options
  • Save pearkes/1864560 to your computer and use it in GitHub Desktop.
Save pearkes/1864560 to your computer and use it in GitHub Desktop.
Using url_for() to separate static paths on dev/prod with Flask
...
STATIC_PATH=str(os.environ.get("STATIC_PATH"))
@app.route(STATIC_PATH, build_only=True)
def static_path():
pass
...
$ export STATIC_PATH=/static
$ heroku config:add STATIC_PATH=https://bucket.s3.amazonaws.com/
<html>
<head>
...
<link href="{{ url_for('static_path') }}/stylesheet.css" rel="stylesheet">
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment