Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Nate Sturgeon
2,255 PointsFlask debugger constantly detecting changes and reloading
I have just started the Flask tutorials. At first, everything was working fine and I was able to get webpages to display and the debugger to do it's thing properly (ie auto-update web pages when changes are saved to my flask app file). Now, all of a sudden, the debugger is constantly detecting changes and updating (happens about once every second). Sometimes this behavior stops randomly when I make a change to app.py, or submit form data on the webpage, but it resumes as soon as I save another change to app.py. The message it gives is:
* Detected change in '/home/treehouse/workspace/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger pin code: 311-115-447
Here is my app.py code that (I presume) is causing the problem:
import json
from flask import (Flask, render_template, redirect,
url_for, request, make_response)
app = Flask(__name__)
def get_saved_data():
try:
data = json.loads(request.cookies.get('character'))
except TypeError:
data = {}
return data
@app.route('/')
def index():
data = get_saved_data()
return render_template('index.html', saves=data)
@app.route('/save', methods=['POST'])
def save():
response = make_response(redirect(url_for('index')))
data = get_saved_data()
data.update(dict(request.form.items()))
response.set_cookie('character', json.dumps(data))
return response
app.run(debug=True, host='0.0.0.0', port=8000)
Other than my app.py file, I haven't made any changes to the templates or static files, aside from the changes to index.html specified in the video tutorial:
{% extends "layout.html" %}
{% block content %}
<!--Enter Name -->
<div class="enter-name">
<div class="grid-100">
<img src="/static/img/bear_avatar.svg" class="bear-avatar" />
</div>
<div class="grid-100">
<form action="{{ url_for('save') }}" method="POST">
<label>Name your bear</label>
<input type="text" name="name" value="{{ saves.get('name', '') }}" autofocus>
<input type="submit" value="Let's build it!">
</form>
</div>
</div>
{% endblock %}