I'm working on a Flask app that uses url_for
to specify the route to some static assets (js, css, etc). Here's an example from one of the templates:
<script src='{{ url_for('static', filename='js/search.js') }}'></script>
When this gets rendered into html, the path looks like this:
<script src='/static/js/search.js'></script>
Is it possible to modify this behavior such that the leading slash is dropped from the rendered script path? The goal is to render the following:
<script src='static/js/search.js'></script>
I'd be very grateful for any insights others can offer on this question!
../../../static/js/search.js
? Why do you want to avoid the absolute URL in the first place? – Moldapp.config['SERVER_NAME'] = IP/cats/meow/
but that does not appear to solve the problem. I'd be grateful for any thoughts you might have on the subject! – Apophysis