Page 1 of 1

Setting up Flask

PostPosted: Thu Sep 08, 2016 10:20 am
by iFunction
Hi there,

I am following this tutorial: http://code.tutsplus.com/tutorials/crea ... -cms-22972
but unfortunately it has completely omitted what to do if the browser is unable to connect to localhost:5000 which is what my browser is doing.

http://localhost/
gives the Apache2 Debian Default Page.

How can I get the Flask bit to work please?

UPDATE: apologies, here is some more information:
Raspbian fresh install
Apache2 installed
Flask installed using pip
no other things have been changed as yet.

Regards
iFunc

Re: Setting up Flask

PostPosted: Thu Sep 08, 2016 5:04 pm
by nilamo
It's a little odd, but the tutorial has different code than their github repo (which is linked at the bottom of the tutorial). The tutorial never actually tells flask what port to listen to. The github app.py has this at the bottom instead:
https://github.com/jay3dec/PythonFlaskMySQLApp---Part-1/blob/master/app.py wrote:
Code: Select all
if __name__ == "__main__":
    app.run(port=5002)

Try that out, and see if it works for you.

Re: Setting up Flask

PostPosted: Thu Sep 08, 2016 6:43 pm
by snippsat
gives the Apache 2 Debian Default Page.

The tutorial dos not mention Apache,they use Flask build web-server to run it.
Clone from GitHub.
Code: Select all
λ git clone https://github.com/jay3dec/PythonFlaskMySQLApp---Part-1.git         

Cd to PythonFlaskMySQLApp---Part-1 folder.
python app.py
In browser.
http://127.0.0.1:5002/

Re: Setting up Flask

PostPosted: Fri Sep 23, 2016 10:37 am
by iFunction
@ nilamo, Yes, I spotted that and just copied the extra bits into my code and it worked, thanks for that.

@ snippsat, Yes, i have Apache installed on here too as I am trying to learn how to build a LAMP stack, rather unsuccessfully it seems.