Setting up Flask

Setting up Flask

Postby iFunction » Thu Sep 08, 2016 10:20 am

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
iFunction
 
Posts: 41
Joined: Mon Apr 04, 2016 2:33 pm

Re: Setting up Flask

Postby nilamo » Thu Sep 08, 2016 5:04 pm

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.
This forum is shutting down. Future discussion should take place at http://python-forum.io
User avatar
nilamo
 
Posts: 87
Joined: Thu Jul 21, 2016 8:00 pm
Location: Michigan

Re: Setting up Flask

Postby snippsat » Thu Sep 08, 2016 6:43 pm

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/
We will be moving to python-forum.io on October 1 2016
User avatar
snippsat
 
Posts: 1251
Joined: Thu Feb 21, 2013 12:04 am

Re: Setting up Flask

Postby iFunction » Fri Sep 23, 2016 10:37 am

@ 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.
iFunction
 
Posts: 41
Joined: Mon Apr 04, 2016 2:33 pm


Return to Web Development

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

cron