flask - Why url of an image is not identical to its actual path?
<p>I'm using <code>flask.send_file</code> to send images to my client.</p>

<p>However, when I was trying to get the url of a image using <code>url_for</code>, I found the result returned is not the same with the image's path.</p>

<pre><code>def get(self):
        print url_for('static', filename='test.jpg')
        filename = 'static/img/test.jpg'
        return send_file(filename)
</code></pre>

<p>I got </p>

<blockquote>
  <p>/static/test.jpg</p>
</blockquote>

<p>in the console.</p>

<p>The file structure is </p>

<pre><code>└── static
    └── img
        └── test.jpg
</code></pre>

<p>Why the url is not <strong><code>/static/img/test.jpg</code></strong>?</p>

<h2>EDIT</h2>

<p>And when I request from the browser, the code above works well. On the contrast, the browser return error if I change the filename to <code>static/test.jpg</code>.</p>