Lesson 3
Screen 1 of 14
1) Components of a Web application
2) Web frameworks and Flask
3) Installing Python and packages
4) Creating your development environment
5) Building your first local Flask app
6) Running your first Flask app
7) Web application deployment
8) Deploying to PythonAnywhere
Lesson 3
Screen 2 of 14
Lesson 3
Screen 3 of 14
The Python website describes Python as:
"a programming language that lets you work more quickly and integrate your systems more effectively."
Lesson 3
Screen 4 of 14
Python's developers describe it as:
"an interpreted, interactive, object-oriented programming language"
The next slides will explain the jargon
Lesson 3
Screen 5 of 14
Interpreted: each time a program is run, the interpreter checks through the code for errors and interprets the instructions into machine readable "bytecode"
Interactive: Python offers the possibility of entering a Python statement followed by the return key, with the result printed on screen. This is an advantage for de-bugging and is a natural way of working
Object-oriented programming (OOP): A programming language organised around objects rather than actions and data rather than logic - this offers a number of advantages over other programming styles shown on the next slide
Lesson 3
Screen 6 of 14
Object oriented programming (OOP) offers several advantages over other programming styles:
Lesson 3
Screen 7 of 14
Now let's install Python!
The Flask Web application you will create (in Lesson 5) will be built using Python.
You can install the latest version of Python by:
Going to https://www.python.org/downloads/
download the latest version of Python V3.xx
choose install now and check add Python to PATH
if you chose download only - goto your downloads directory and run the python-3xx.exe installer file
Lesson 3
Screen 8 of 14
Next we will verify that installation was successful
To test that Python installed on your computer:
Lesson 3
Screen 9 of 14
for details
1. Open a Windows command prompt (cmd)
2. Type 'python' into cmd, then press return
3. To close Python, type 'quit()' into cmd and press return
about your installed Python version (as shown).
Lesson 3
Screen 10 of 14
Developers can organise sections of code, which relate to the same feature(s), by grouping them into a single file. For example, all code that displays a login prompt to an end-user can be saved into one file.
Simply put: 'Python has packages for directories and modules for files' (Programiz 2018).
All files containing code to create all end-user displays (or 'views') can then be group in directories.
You will install packages for Python in Lesson 4, to build your first Web Flask application.
Lesson 3
Screen 11 of 14
pip is a command line program for downloading, installing and managing shared Python packages.
The default source of packages pip installs is the Python Package Index (PyPI). PyPI contains packages that have been approved for use by Developers. For example, Flask is a Python package, with many modules, available from PyPI.
pip is included with Python since version 3.4 (Python Packaging Authority 2018).
Developers can share useful packages and modules.
Lesson 3
Screen 12 of 14
Complete the quiz to test your knowledge of Python.
You have completed Lesson 3 on installing Python and packages. You can now:
Lesson 3
Screen 13 of 14
In Lesson 4 you apply what you learned about Python and pip, to prepare your computer for creating your first Flask app.
Proceed to Lesson 4.
Lesson 3
Screen 14 of 14