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!

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

Python Flask Basics Welcome to Flask Clean URL Arguments

Have to relaunch the program after changing code.

from flask import Flask

app = Flask(__name__)

def index(name="Treehouse"):
    return "Hello from {}".format(name)

def add(num1, num2):
    return '{} + {} = {}'.format(num1, num2, num1+num2)

app.run(debug=True, port=8000, host='')

Using the code above. debug is set to True. I'm finding that in addition to saving the program, I have to relaunch it in the console, otherwise the port8000 view redirects me to the same webpage as the one coming from older version. Pls tell me what I may be doing wrong. Thanks.

2 Answers

Try this in the terminal:

$ export FLASK_ENV=development
$ flask run


Thank you for the info,

so, I'm able to pass export FLASK_ENV=development but I get an error on the next bit, which is flask run:

bash: flask: command not found.

Now i'm not sure if this has something to do with the fact that this is being run on workspaces on treehouse servers.