Skip to content
Snippets Groups Projects
Commit 7fa2b3a7 authored by robban64's avatar robban64
Browse files
parents 7a779c0e 8150fb02
No related branches found
No related tags found
No related merge requests found
Pipeline #47137 passed
......@@ -11,7 +11,7 @@ server:setup:
expire_in: 15 min
untracked: true
cache:
key: "$CI_COMMIT_REF_SLUG"
key: '$CI_COMMIT_REF_SLUG'
paths:
- server/env
script:
......@@ -20,12 +20,12 @@ server:setup:
- cd server/
- python -m venv env
- source env/bin/activate
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
server:test:
image: python
stage: test
needs: ["server:setup"]
needs: ['server:setup']
only:
refs:
- dev
......@@ -43,7 +43,7 @@ server:test:
server:report:
image: python
stage: report
needs: ["server:test"]
needs: ['server:test']
only:
refs:
- merge_requests
......
# Installing the server
It is recommended to use [Visual Studio Code](https://code.visualstudio.com/) to install and use the server, but it is not necessary.
In order to install the server, you will need to do the following:
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](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system):
```bash
git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system
cd ./teknikattan-scoring-system/
```
Install [Python](https://www.python.org/downloads/).
Clone the git repository [teknikattan-scoring-system](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system).
Make sure `Python` is [installed properly](#running-python).
Open a terminal and navigate to the root of the cloned project.
Make sure `pip` is [installed properly](#running-pip).
Install virtualenv and create a virtual environment:
......@@ -17,28 +25,133 @@ cd server
py -m venv env
```
Activate the virtual environment (which is done slightly differently on Windows and Linux/Mac):
On Windows:
Activate the virtual environment:
```bash
Set-ExecutionPolicy Unrestricted -Scope Process
./env/Scripts/activate
```
On Linux/Mac:
Continue to [development and production](#development-and-production).
## Linux (Ubuntu)
Clone the Git [repository](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system):
```bash
git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system
cd ./teknikattan-scoring-system/
```
Install [Python](https://www.python.org/downloads/).
Make sure `Python` is [installed properly](#running-python).
Install pip:
```bash
sudo apt install python3-pip
```
Make sure `pip` is [installed properly](#running-pip).
Install and create a Python virutal environment and activate it:
```bash
sudo apt install python3-venv
cd server
py -m venv env
source env/bin/activate
```
Lastly, install all project dependencies:
Continue to [development and production](#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:
```bash
pip install -r requirements.txt
```
If you are a developer:
```bash
pip install -r requirements-dev.txt
```
You should now be ready to start the server.
Try it by running `python main.py` and navigate to `localhost:5000`.
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](../development/vscode.md) `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:
```bash
py --version
```
Make sure Python version > 3.
If it works, you should see something along the lines of:
```bash
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:
```bash
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](https://pip.pypa.io/en/stable/installing/).
### Problem: Failed building wheel for \<package\> when calling pip
Run the following command before installing the requirements:
```
pip install wheel
```
This [guide](https://stackoverflow.com/questions/53204916/what-is-the-meaning-of-failed-building-wheel-for-x-in-pip-install)
can help you troubleshoot this problem further.
### Problem: psycopg
```
pip install psycopg2
```
......@@ -65,6 +65,10 @@ pip install -r requirements.txt
```
The last step is to install all the required packages.
If you are running it in production, run `pip install -r requirements.txt`.
But if you are a developer, run `pip install -r requirements-dev.txt`.
## Common problems
### Make sure python +3.8 is running with the python command
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment