Preview

1 - Intro to Flask (zero to pro in 5 lessons)

 1. _______ is a lightweight web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications.
It began as a simple wrapper around Werkzeug and Jinja
and has become one of the most popular Python web 
application frameworks.

  Flask

  Jinja

  Python

  Routes

 2. The easiest way to install external libraries in python is to use ____. It is a package management system used to install and manage software packages written in Python.

  cmd

  pip

  requests

  pygame

 3. The command prompt (cmd) is an incredibly useful and fast tool. To create a directory using CMD you would use the command:

  dircreate

  createdir

  mkdir

  crdir

 4. You are currently on your desktop but want to enter into a folder on your desktop called: "myflask". What command would allow you to do so?

  cto myflask

  myflask change

  dir myflask

  cd myflask

 5. At its core, the main purpose of Python ____________ is to create an isolated environment for Python projects.
Note: This means that each project 
can have its own dependencies, 
regardless of what dependencies every 
other project has.

  command prompt dialogues

  flask environments

  virtual environments

  frameworks

 6. The command (Windows) to activate and enter into your virtual environment, once created, would be:

  venv\activate

  activate\Scripts\env

  env\Scripts\activate

  env\activate\now

 7. Refer to the following code. What will be displayed on the screen on typing in the following URL into the browser: localhost/about (note: localhost is the server's URL)
#bigquestions.py

from flask import Flask 
app = Flask(__name__) 
@app.route('/')
@app.route('/home')
def hello_world():
    return "<h1>Big Questions</h1>"


@app.route('/aboutme') 
def aboutme():
    return "<h1>About Page</h1>"


#this conditional will be true if we run this script and file with python directly
if __name__ == '__main__':
 	app.run(debug=True)

  The word

  The routes have been defined incorrectly. It will display the words

  The words

  Nothing - because the route that has been defined is "aboutme". There is no "about" route.

 8. What is wrong with the following code that is defining a route for a help page?
def help()
    return "

Help Page

"

  Nothing is wrong - it will work fine!

  The word 'def' on line 1 should be changed to 'help'

  There is a missing colon on line 1. It should be def help():

  The return comand should say "render" instead of return

 9. The following is the sort of thing you will see when the server is running. How do you quit the server?
Running on http://127.0.0.1:5000/ 

  Press CTRL+C to quit

  Shut down the computer to quit

  Press ESC to quit

  Press CTRL+1+F to quit

 10. If the name of your main python file is bigquestions.py, what do you type in to CMD to run the server? (assume you've followed the steps in this video tutorial)

  >>python run bigquestions

  >>run flask bigquestions.py

  >>flask bigquestions

  >>python bigquestions.py