Python Flask Basics Welcome to Flask Clean URL Arguments

Ibrahim Khan
Ibrahim Khan
3,353 Points

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), 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

Ibrahim Khan
Ibrahim Khan
3,353 Points

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.