<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">App should run as expected on 127.0.0.1 with debugger mode enabled</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Paste a minimal example that causes the problem.
# .. E:/web/public/myblog.in/hello.py
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'"><pre class="notranslate"><span class="pl-c"># Paste a minimal example that causes the problem.</span>
<span class="pl-c"># .. E:/web/public/myblog.in/hello.py</span>
<span class="pl-k">from</span> <span class="pl-s1">flask</span> <span class="pl-k">import</span> <span class="pl-v">Flask</span>
<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Flask</span>(<span class="pl-s1">__name__</span>)

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">route</span>(<span class="pl-s">'/'</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">hello_world</span>():
    <span class="pl-k">return</span> <span class="pl-s">'Hello, World!'</span></pre></div>
<p dir="auto">all configs and venv enabled as <a href="https://flask.palletsprojects.com/en/1.1.x/quickstart/" rel="nofollow">https://flask.palletsprojects.com/en/1.1.x/quickstart/</a></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export FLASK_APP=hello.py
"><pre class="notranslate"><span class="pl-k">export</span> FLASK_APP=hello.py
</pre></div>
<h3 dir="auto">Actual Behavior</h3>

<p dir="auto"><code class="notranslate">flask run</code> works as expected. I can see the "Hello world" without issues, <strong>unless</strong> I enabled debug mode as <code class="notranslate">export FLASK_ENV=development</code> in which case if I run <code class="notranslate">flask run</code> I get</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ flask run                                                                                                                                                                                                        
 * Serving Flask app &quot;hello.py&quot; (lazy loading)                                                                                                                                                                     
 * Environment: development                                                                                                                                                                                        
 * Debug mode: on                                                                                                                                                                                                  
 * Restarting with stat                                                                                                                                                                                            
e:\web\public\myblog.in\venv\scripts\python.exe: Error while finding module specification for 'E:\\web\\public\\myblog.in\\venv\\Scripts\\flask' (ModuleNotFoundError: No module named 'E:\\web\\public\\myblog')  "><pre class="notranslate">$ flask run                                                                                                                                                                                                        
 <span class="pl-k">*</span> Serving Flask app <span class="pl-s"><span class="pl-pds">"</span>hello.py<span class="pl-pds">"</span></span> (lazy loading)                                                                                                                                                                     
 <span class="pl-k">*</span> Environment: development                                                                                                                                                                                        
 <span class="pl-k">*</span> Debug mode: on                                                                                                                                                                                                  
 <span class="pl-k">*</span> Restarting with stat                                                                                                                                                                                            
e:<span class="pl-cce">\w</span>eb<span class="pl-cce">\p</span>ublic<span class="pl-cce">\m</span>yblog.in<span class="pl-cce">\v</span>env<span class="pl-cce">\s</span>cripts<span class="pl-cce">\p</span>ython.exe: Error <span class="pl-k">while</span> finding module specification <span class="pl-k">for</span> <span class="pl-s"><span class="pl-pds">'</span>E:\\web\\public\\myblog.in\\venv\\Scripts\\flask<span class="pl-pds">'</span></span> (ModuleNotFoundError: No module named <span class="pl-s"><span class="pl-pds">'</span>E:\\web\\public\\myblog<span class="pl-pds">'</span></span>)  </pre></div>
<p dir="auto">You can see in the last error it says <code class="notranslate">No module named 'E:\\web\\public\\myblog</code> (it should be ..<code class="notranslate">\\myblog.in</code> <strong>(.in)</strong> is missing, maybe that is the issue (bug)</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Python version: 3.7.1</li>
<li>Flask version: 1.1.x</li>
<li>Werkzeug version: 0.15.5</li>
</ul>
<p dir="auto">When <code class="notranslate">jsonify</code> is called on an object with a 'date' it throws:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: datetime.date(2012, 3, 30) is not JSON serializable"><pre class="notranslate"><code class="notranslate">TypeError: datetime.date(2012, 3, 30) is not JSON serializable
</code></pre></div>
<p dir="auto">There is an innocuous fix - see <a href="http://stackoverflow.com/questions/455580" rel="nofollow">http://stackoverflow.com/questions/455580</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="def date_handler(obj):
    if hasattr(obj, 'isoformat'):
        return obj.isoformat()
    else:
        raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (type(obj), repr(obj))"><pre class="notranslate"><code class="notranslate">def date_handler(obj):
    if hasattr(obj, 'isoformat'):
        return obj.isoformat()
    else:
        raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (type(obj), repr(obj))
</code></pre></div>
<p dir="auto">And <a href="https://github.com/mitsuhiko/flask/blob/master/flask/helpers.py#L142">https://github.com/mitsuhiko/flask/blob/master/flask/helpers.py#L142</a> becomes:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="json_str = json.dumps(dict(*args, **kwargs), indent=None, default=date_handler)"><pre class="notranslate"><code class="notranslate">json_str = json.dumps(dict(*args, **kwargs), indent=None, default=date_handler)
</code></pre></div>
<p dir="auto">This strikes me as preferable to TypeError.</p>
<p dir="auto">Alternatively, <code class="notranslate">jsonify</code> could accept a <code class="notranslate">default</code> argument that is passed to <code class="notranslate">json.dumps</code>.</p>