In database terminology primary key refers to the column in a table that's intended to be the primary way of identifying rows. Each table must have exactly one, and it needs to be unique. This is usually some kind of a unique identifier associated with objects presented by the table, or if such an identifier doesn't exist simply a running ID number (which is incremented automatically).
Initial Steps¶
- Install Python 3: https://www.python.org/downloads/
- If you are using Windows be sure that python folder, python/Scripts and python/Lib are included in the Path Environment Variable.
NOTE: Python 2.7 is not maintained anymore, so you should not use it. If you still need it and want to keep Python 2.7 and Python 3.7 in the same machine have a look to this tutorial: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/, or just create virtual environments with the different executables
Installing GIT¶
Follow the instructions in this link https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Installing and setting up virtual environment (optional)¶
(This section has been adapted from Chapter 1 of the book Flask Web Development by Miguel Grinberg)
A virtual environment is a private copy of the Python interpreter onto which you can install packages privately, without affecting the global Python interpreter installed in your system. Creating a virtual environment for each application ensures that applications have access to only the packages that they use, while the global interpreter remains neat and clean and serves only as a source from which more virtual environments can be created. During this course we recommend you to use a virtual environment to run your PWP exercises. In that way, you do not need to worry which version of software you have installed.
The next step is to create the Python virtual environment inside your chose folder. You can use any folder of your system, since to execute
virtualenv
command you do not need administration privileges. The virtualenv
command has a single required argument: the name of the virtual environment. A folder with the chosen name will be created in the current directory and all files associated with the virtual environment will be inside. We recommend you to name this virtualenv pwp.python3 -m venv /path/to/new/virtual/environment
To start using the virtual environment, you have to “activate” it. If you are using a bash command line (Linux and Mac OS users), you can activate the virtual environment with this command:
$ source pwp/bin/activate
If you are using Microsoft Windows, the activation command is:
> pwp\Scripts\activate.bat
Or if you are using PowerShell
> pwp\Scripts\activate.ps1
When a virtual environment is activated, the location of its Python interpreter is added to the PATH, but this change is not permanent; it affects only your current command session. To remind you that you have activated a virtual environment, the activation command modifies the command prompt to include the name of the environment:
(pwp) $
(pwp) $
When you are done working with the virtual environment and want to return to the global Python interpreter, type deactivate at the command prompt.
Now you can use the virtual environment you have just created to install all required software for your pwp. Whenever, you want to work in your pwp exercises just activate the pwp virtual environment.
Storing your virtual environment¶
If you want to create a copy of your virtual environment you need to create a requirements.txt file.
pip freeze > requirements.txt
Installing python exercise libraries¶
Use the following install commands to install the latest versions of each library. It is highly recommended to do this in a virtual environment.
pip install flask pip install flask-caching pip install flask-restful pip install flask-sqlalchemy pip install jsonschema pip install pytest pip install pytest-coverage pip install rfc3339-validator
Installing Chrome plugins and apps¶
In order to test the RESTful API, we must send to the server HTTP requests and check the corresponding HTTP response. During the exercises, apart from creating functional tests using the python unittest library, we are also using one of the multiple Chrome plugins that enables the creation of REST HTTP requests. You can install this Chrome plugin:
In addition to the previous Chrome plugin you can use the following apps:
Or you can use this online tool: