Skip to content

Commit

Permalink
Merge branch 'main' into api-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
manuGil authored Mar 27, 2024
2 parents fc44346 + 3219557 commit c022200
Show file tree
Hide file tree
Showing 6 changed files with 7,086 additions and 103 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/django-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- devel
- main

push:
branches:
- devel
Expand All @@ -19,14 +19,14 @@ jobs:
services:
postgres:
image: postgis/postgis:14-master
env: # environmental variables required for the job
env: # environmental variables required for the job
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
ports:
- 5432:5432

options: >-
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
Expand All @@ -40,15 +40,15 @@ jobs:
path: ~/.cache/zip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-
- name: Setup python environment
uses: actions/setup-python@v3
with:
python-version: "3.x"
python-version: '3.x'
- name: Install GDAL library
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo add-apt-repository ppa:ubuntugis/ppa -y
sudo apt-get update -y
sudo apt-get install gdal-bin libgdal-dev -y
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
Expand All @@ -63,5 +63,6 @@ jobs:
run: |
nohup python citizenvoice/manage.py runserver &
sleep 5
- name: Stop Development Server
- name: Stop Development Server
run: pkill -f runserver

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sdist/
vue/
node_modules/
package-lock.json
package.json
var/
wheels/
pip-wheel-metadata/
Expand Down
40 changes: 1 addition & 39 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,42 +73,4 @@ python manage.py test
### GitHub

1. Make sure that the GitHub-Zenodo integration is enabled for https://github.com/NLeSC/python-template
1. Go to https://github.com/NLeSC/python-template/releases and click `Draft a new release`

### The REST API and authentication

We are using Django rest knox for authentication. Knox authentication is token based, similar to the TokenAuthentication.
This means some API's are protected and can only be called with a authentication token.
To get an valid authentication token you need to have an account and then login with that account.
Example using postman:
Create a new POST request to `http://127.0.0.1:8000/api/auth/login/` in the body add the next key value pairs in `from-data`:
| key | value |
| -------- | ------------- |
| email | `<you email>` |
| password | `<your pass>` |
As a response you will receive:
```json
{
"expiry": "2023-01-24T11:00:24.545608Z",
"token": "<token>",
"user": {
"id": <id>,
"username": "<name>",
"email": "<email></email>"
}
}
```
Use the token string to fetch authenticated API's:
Create a new GET request in postman to `http://127.0.0.1:8000/api/auth/me`. In the `Headers` add the key value pair:

| key | value |
| ------------- | --------------- |
| Authorization | Token `<token>` |

Make sure your using the same capitals and have a space between `Token` and `<token>`.

Now you should get the authenticated user data.
1. Go to https://github.com/NLeSC/python-template/releases and click `Draft a new release`
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ If you use this software, please cite it as follows:

| [Role](https://credit.niso.org/contributor-roles-defined/) | Author |
|------|--------|
| Conceptulization | Goncalves, J. E., Forgaci, C., Verma, T., & Garcia Alvarez, M. |
| Conceptualization | Goncalves, J. E., Forgaci, C., Verma, T., & Garcia Alvarez, M. |
| Funding acquisition | Goncalves, J. E., Forgaci, C., & Verma, T.|
| Project administration | Goncalves, J. E., Forgaci, C., & Verma, T. |
| Investigation | Ioannou I. |
| Project management | Goncalves, J. E. |
| Research | Goncalves, J. E., Ioannou I., Forgaci, C., & Verma, T. |
| Software | van der Laarse, G., Ijpma, J., Aslan, Y., & Garcia Alvarez, M. |
| Supervision | Garcia Alvarez, M. |

Expand Down
52 changes: 0 additions & 52 deletions frontend/package.json

This file was deleted.

Loading

0 comments on commit c022200

Please sign in to comment.