Skip to content

Commit

Permalink
Replace Quart with Starlette
Browse files Browse the repository at this point in the history
  • Loading branch information
dnknth committed Oct 15, 2024
1 parent 689ef72 commit 1d70132
Show file tree
Hide file tree
Showing 19 changed files with 1,206 additions and 621 deletions.
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Starlette",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"app:app",
"--port",
"5000",
"--reload"
]
}
]
}
20 changes: 18 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
{
"css.customData": [".vscode/tailwind.json"]
}
"css.customData": [".vscode/tailwind.json"],
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"*test.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ RUN npm audit && npm i && npm run build
FROM alpine:3
COPY --from=builder /app/dist /app/dist
RUN apk add --no-cache python3 py3-pip py3-pyldap py3-pytoml \
&& pip3 install --break-system-packages python-dotenv Quart
COPY app.py settings.py /app/
&& pip3 install --break-system-packages python-multipart starlette uvicorn
COPY app.py ldap_api.py ldap_helpers.py schema.py settings.py /app/

WORKDIR /app
EXPOSE 5000
CMD ["/usr/bin/hypercorn", "-b", "0.0.0.0:5000", "--access-logfile", "-", "app:app"]
CMD ["/usr/bin/uvicorn", "--host", "0.0.0.0", "--port", "5000", "app:app"]
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
TAG = latest-$(subst aarch64,arm64,$(shell uname -m))

debug: app.py settings.py .env .venv3 dist
QUART_APP=$< QUART_ENV=development \
.venv3/bin/python3 .venv3/bin/quart run
.venv3/bin/python3 .venv3/bin/uvicorn --reload --port 5000 app:app

run: app.py settings.py .env .venv3 dist
.venv3/bin/hypercorn -b 0.0.0.0:5000 --access-logfile - app:app
.venv3/bin/uvicorn --host 0.0.0.0 --port 5000 app:app

.env: env.example
cp $< $@
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ Additionally, arbitrary attributes can be searched with an LDAP filter specifica

## Acknowledgements

The Python backend uses [Quart](https://pgjones.gitlab.io/quart/index.html) which is an asynchronous [Flask](http://flask.pocoo.org/). The UI is built with [Vue.js](https://vuejs.org) and [Tailwind](https://tailwindcss.com/) for CSS. Kudos for the authors of these elegant frameworks!
The Python backend uses [Starlette](https://starlette.io). The UI is built with [Vue.js](https://vuejs.org) and [Tailwind](https://tailwindcss.com/) for CSS. Kudos for the authors of these elegant frameworks!
Loading

0 comments on commit 1d70132

Please sign in to comment.