title: Flask: How to get url for dynamically generated image file?
body: <pre><code>from flask import Flask, redirect, url_for
  
  app = Flask(__name__)
  @app.route('/')
  def index():
          generate_img("test.jpg");
          return '&lt;img src=' + url_for(filename='test.jpg') + '&gt;'
  </code></pre>
  
  <p><code>generate_img()</code> will output a random image to the current directory (same folder as this script).</p>
  
  <p>I am getting 404, I navigate to mydomain.com/test.jpg but it's not there.</p>