Created
February 19, 2012 16:35
-
-
Save pearkes/1864560 to your computer and use it in GitHub Desktop.
Using url_for() to separate static paths on dev/prod with Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
STATIC_PATH=str(os.environ.get("STATIC_PATH")) | |
@app.route(STATIC_PATH, build_only=True) | |
def static_path(): | |
pass | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export STATIC_PATH=/static | |
$ heroku config:add STATIC_PATH=https://bucket.s3.amazonaws.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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