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.7.2: 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: If you want to keep in the same machine Python 2.7 and Python 3.7 have a look to this tutorial: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/
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.
You can install virtual environment using pip:
pip install virtualenv
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.virtualenv pwp
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
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¶
The following file contains the libraries (names and versions that we are going to use in the PWP exercises).
Download the file and execute the following command, in order to install those dependencies.
pip install -r pwp_requirements.txt
NOTE: We strongly recommend you to install this dependencies in a virtual environment
Installing Chrome plugins¶
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 any of the following Chrome plugins: