Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xrmx/isdjangoasyncyet-demo
https://github.com/xrmx/isdjangoasyncyet-demo
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/xrmx/isdjangoasyncyet-demo
- Owner: xrmx
- License: mit
- Created: 2024-04-25T12:45:20.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-23T17:36:00.000Z (6 months ago)
- Last Synced: 2024-10-14T12:22:13.277Z (about 1 month ago)
- Language: Python
- Size: 143 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# isdjangoasyncyet-demo
This is a demo for the talk *Is Django async yet?*.
## Requirements
A Docker Compose V2 file is provided to run the Postgresql database.
You can start the database with:
```
docker compose up
```On another shell you can create the virtual environment and install the requirements:
```
python3 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt
```## How to run the sync demo
This assumes the environment has been created and is activated.
You can start the async application with the following command:
```
cd demo
gunicorn demo:wsgi --workers 1 --bind 0.0.0.0:8000
```The API will be available at [http://localhost:8000](http://localhost:8000).
## How to run the async demo
This assumes the environment has been created and is activated.
You can start the async application with the following command:
```
cd ademo
gunicorn ademo.asgi:application --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8080
```The API will be available at [http://localhost:8080](http://localhost:8080).
### OpenTelemetry instrumentation
If you want to debug `asgiref.sync` `sync_to_async` and `async_to_sync` usage you can run the service using
OpenTelemetry automatic instrumentation:```
opentelemetry-instrument --traces_exporter console --metrics_exporter none --service_name ademo \
gunicorn ademo.asgi:application --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8080
```