omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


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

    Pythonista
    4
    5
    3050
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gruntfutuk
      gruntfutuk last edited by 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.

      kyber 1 Reply Last reply Reply Quote 0
      • brumm
        brumm last edited by

        app.run(debug=False)
        
        1 Reply Last reply Reply Quote 0
        • gruntfutuk
          gruntfutuk last edited by

          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 1 Reply Last reply Reply Quote 0
          • mikael
            mikael @gruntfutuk last edited by

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

            1 Reply Last reply Reply Quote 0
            • kyber
              kyber @gruntfutuk last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors