Installing the server

The steps to install the server depend on if you are on Windows or Linux and if you are a developer or are running it in production.

Windows

Clone the Git repository:

git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system
cd ./teknikattan-scoring-system/

Install Python.

Make sure Python is installed properly.

Make sure pip is installed properly.

Install virtualenv and create a virtual environment:

pip install virtualenv
cd server
py -m venv env

Activate the virtual environment:

Set-ExecutionPolicy Unrestricted -Scope Process
./env/Scripts/activate

Continue to development and production.

Linux (Ubuntu)

Clone the Git repository:

git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system
cd ./teknikattan-scoring-system/

Install Python.

Make sure Python is installed properly.

Install pip:

sudo apt install python3-pip

Make sure pip is installed properly.

Install and create a Python virutal environment and activate it:

sudo apt install python3-venv
cd server
py -m venv env
source env/bin/activate

Continue to development and production.

Development and production

Which dependencies you install will depend on if you are a developer or running the server in production.

If running in production:

pip install -r requirements.txt

If you are a developer:

pip install -r requirements-dev.txt

You should now be ready to start the server. Try it by running py main.py and navigate to localhost:5000. If everything worked as it should you should see a list of all available API calls. If you are using VS Code you can also start the server with the task start server.

Common issues

If you have any issues while installing, some of the things below might help.

Running Python

Test that Python is installed properly:

py --version

Make sure Python version > 3. If it works, you should see something along the lines of:

Python 3.9.4

If py is not working, try one of the following instead:

py -3
py3
python
python3

Running pip

Test that pip is installed properly:

pip --version

Make sure pip is running with Python 3.x (not Python 2.x). If everything works, it should look something along the lines of:

pip 20.2.3 from d:\home\workspace\teknikattan-scoring-system\server\env\lib\site-packages\pip (python 3.9)

If pip is not running with Python 3.x, try one of the following instead:

pip3
py -m pip

If you still have trouble, try this guide.

Problem: Failed building wheel for <package> when calling pip

Run the following command before installing the requirements:

pip install wheel

This guide can help you troubleshoot this problem further.

Problem: psycopg

pip install psycopg2