2021-06-12 10:06:40 +02:00
|
|
|
|
# Kompetenzinventar Backend
|
2021-05-31 18:45:15 +02:00
|
|
|
|
|
2021-06-06 22:25:10 +02:00
|
|
|
|
## Entwicklung
|
|
|
|
|
|
|
|
|
|
### Abhängigkeiten
|
|
|
|
|
|
|
|
|
|
- Python 3.8
|
|
|
|
|
- [Pipenv](https://github.com/pypa/pipenv)
|
|
|
|
|
|
|
|
|
|
### Entwicklungsumgebung aufbauen und starten
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cp env.dev .env
|
2021-06-12 13:24:26 +02:00
|
|
|
|
pipenv install --dev
|
2021-06-06 22:25:10 +02:00
|
|
|
|
pipenv shell
|
2021-06-07 17:52:14 +02:00
|
|
|
|
export FLASK_APP=app.py
|
2021-06-06 22:25:10 +02:00
|
|
|
|
flask db upgrade
|
2021-06-12 13:24:26 +02:00
|
|
|
|
flask seed
|
2021-06-06 22:25:10 +02:00
|
|
|
|
flask run
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
http://localhost:5000/
|
2021-06-07 22:04:03 +02:00
|
|
|
|
|
2021-06-12 13:24:26 +02:00
|
|
|
|
|
2021-06-13 21:41:01 +02:00
|
|
|
|
### Tests ausführen
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
python -m unittest discover ki
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2021-06-12 13:24:26 +02:00
|
|
|
|
### Testbenutzer
|
|
|
|
|
|
|
|
|
|
Für ein Login ohne LDAP werden die Benutzer aus der [`auth.yml`](./data/auth.yml) benutzt.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Test-Requests
|
|
|
|
|
|
|
|
|
|
Beispiele brauchen curl und jq.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
curl -s \
|
|
|
|
|
-D "/dev/stderr" \
|
|
|
|
|
http://localhost:5000/skills?search=ph | jq
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
curl -s \
|
|
|
|
|
-D "/dev/stderr" \
|
|
|
|
|
http://localhost:5000/languages?search=fr | jq
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
curl -s \
|
|
|
|
|
-D "/dev/stderr" \
|
|
|
|
|
-X POST \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{"username": "peter", "password": "geheim"}' \
|
|
|
|
|
http://localhost:5000/users/login | jq
|
|
|
|
|
```
|
|
|
|
|
|
2021-06-13 19:41:32 +02:00
|
|
|
|
```
|
|
|
|
|
curl -s \
|
|
|
|
|
-D "/dev/stderr" \
|
|
|
|
|
-H "Authorization: Bearer 22e6c5fc-8a5a-440e-b1f4-018deb9fd24e" \
|
|
|
|
|
http://localhost:5000/users/1/profile
|
|
|
|
|
```
|
|
|
|
|
|
2021-06-12 10:06:40 +02:00
|
|
|
|
### Produktionsumgebung
|
|
|
|
|
|
|
|
|
|
Für die Produktionsumgebung wird [waitress](https://docs.pylonsproject.org/projects/waitress/en/latest/) benutzt.
|
|
|
|
|
|
|
|
|
|
[`run_prod.py`](./run_prod.py) führt die DB Migrationen aus und startet den Server.
|
|
|
|
|
|
2021-06-07 22:04:03 +02:00
|
|
|
|
### Quellen
|
|
|
|
|
|
|
|
|
|
* [`./data/iso_639_1.csv`](https://de.wikipedia.org/wiki/Liste_der_ISO-639-1-Codes)
|
|
|
|
|
* [`./data/imgs/flags`](https://github.com/gosquared/flags)
|