Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Replace Flask's url_for with app_template_url_for#430

Open
rnagle wants to merge 5 commits intonprapps:masterfrom
INN:app-template-url-for
Open

Replace Flask's url_for with app_template_url_for#430
rnagle wants to merge 5 commits intonprapps:masterfrom
INN:app-template-url-for

Conversation

@rnagle
Copy link

@rnagle rnagle commented Nov 10, 2014

app_template_url_for is a little helper function that takes into account the deployment target when building urls. It inserts the project's slug/path prefix when building for staging or prod.

Note that I'm overriding Flask's url_for with app_template_url_for in app.py.

Also added static_folder='www/assets' to the Flask instance so that {{ url_for('static', filename="some_file.png") }} works properly when some_file.png is in www/assets/.

I wrote this because I couldn't find a way to configure the Flask object to do this for me. Maybe I'm missing something. Let me know what you think!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant