https://github.com/seapagan/fastapi-jinja-websockets
A quick simple example to show using FastAPI and Jinja templates using WebSockets to update an already served template.
https://github.com/seapagan/fastapi-jinja-websockets
fastapi jinja2 python templates websockets
Last synced: 9 months ago
JSON representation
A quick simple example to show using FastAPI and Jinja templates using WebSockets to update an already served template.
- Host: GitHub
- URL: https://github.com/seapagan/fastapi-jinja-websockets
- Owner: seapagan
- License: mit
- Created: 2024-08-18T09:27:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-24T15:39:20.000Z (10 months ago)
- Last Synced: 2025-04-05T13:53:23.334Z (10 months ago)
- Topics: fastapi, jinja2, python, templates, websockets
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Example FastAPI / Websocket application
A quick simple example to show using FastAPI and Jinja templates using
WebSockets to update an already served template.
This also uses `GraphQL` to access the GitHub API, and ties into the 'uvicorn'
default logger to keep consistent formatting.
No attempt has ben made to style this app, it's just for my testing and for
others to learn. Eventually I will add this a a FastAPI/Jinja based projects
showcase.
## GitHub Token
You need to add your GitHub token as an environment variable:
```console
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
```
> [!IMPORTANT]
> You need to have [poetry](https://python-poetry.org/) installed as that is
> used for dependency management
Install the dependencies and enter the virtualenv:
```console
poetry install
poetry shell
```
Then, run the app using `uvicorn`:
```console
uvicorn main:app --reload
```
Open the app in your browser as to see the app. There
is a 'Refresh Stats' button to update from the WebSocket