Forum Archive

Getting started with Flask ... can't get past first base

gruntfutuk

I've been learning Python for a while now (after a break from programming of several decades) but have concentrated on console work. Thought it was time to do some web stuff and decided to give Flask a go.

I note that it is installed as standard in Pythonista. I assumed I just entered the basic hello world code.

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

and whilst I get no errors when I execute the above, nor do I get anything else. Is a flask server running in the background? Do I need to open a web browser with a particular url. I was anticipating 127.0.0.1:8080 as a guess but there is nothing there.

Please point me in the right direction.

brumm
app.run(debug=False)
gruntfutuk

Brilliant. Thank you. Worked fine. Now to work.

Is that normally required, or specific to Pythonista? I don't recall seeing it in basic introductions for Flask.

mikael

@gruntfutuk, yes, you need to run the server, regardless of the platform.

kyber

@gruntfutuk contact me