1. Creating Web Applications Using Flask

Flask WSGI

Based on the following Youtube Tutorial.

Other useful links and tutorials can be found here:

How to Install and Use Flask on Windows for Beginners (2019)


  1. Make sure have installed Python (currently 3.7.3)
  2. Create a folder where your App will be stored, eg. Q:\flashDemo

  3. Create a Virtual Environment - so that configuration only applies to the virtual environment only
    1. Open CMD
    2. Nav to Q:\flashDemo folder
    3. Q:\flaskDemo>py -m venv env
      1. Slight delay while it installs
      2. Creates a new folder called 'env'
      3. Activate the env by:
        1. env\Scripts\activate
        2. Next prompt will be:
          1. (env) Q:\flaskDemo>
      4. Now install Flask:  pip install flask
      5. Now cd to env folder
      6. Create in text editor (e.g. Notepad++) a new file called: app.py
      7. Back to CMD prompt 
        1. set an environment variable to tell what file to run when flask runs:
          1. set FLASK_APP=app.py
      8. In text editor, now work on app.py
        1. from flask import Flask // get Flask class from package
        2. Setup a route:
          1. @app.route('/')    // route to a URL endpoint in my app
          2. def index():   //method to run at the route/endpoint
            1. return '<h1>Hello!</h1>'   //returns directly to the browser
      9. CMD prompt:
        1. Run the flask app setup earlier
          1. flask run
(env) Q:\flaskDemo>flask run
* Serving Flask app "app.py"
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    1. Copy the URL: http://127.0.0.1:5000/
    2. paste it into browser

    • Now to pass parameter modify to include a name parameter in app.py
@app.route('/<name>')
def index(name):
return f'<h1>Hello {name}!</h1>'
    • Now ctrl-c to kill the app and re-run flash run again
    • Type in browser:
      • http://127.0.0.1:5000/Joe
      • Hello Joe! appears in browser

    • When finished
      • Ctrl-C to stop app
      • deactivate


Comments