Skip to main content

Django PostgreSQL backend proxied over WebSockets (for WASM)

Project description

django-postgresql-ws

django-postgresql-ws is an alternative PostgreSQL backend for Django proxied over WebSockets. It will only work when configured to run against a WebSockets proxy that is then communicating with the PostgreSQL server. websockify is the standard WebSockets proxy service it is tested against.

The purpose of this backend is to allow a Django application to run against a PostgreSQL server in a WebAssembly (Pyodide) environment, where native sockets are not allowed but WebSockets are. The WebSocket communication is handled by the pgwasm library, which itself switches between using a the native websockets libray when being run in a native environment, and using the JS-proxied interface when run under Pyodide.

This backend is based on a copy of the PostgreSQL backend that ships with Django 4.1 with updates made to use pgwasm instead of psycopg2. Note that while Django does not natively support async in its implementation of its ORM, the database backend needs to be async in order to communicate over WebSockets in Pyodide, since the JS interface receives WebSockets messages via callbacks. The async_to_sync method provided by asgiref properly handle running the async methods in the proper event loop.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_postgresql_ws-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_postgresql_ws-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file django_postgresql_ws-0.1.0.tar.gz.

File metadata

  • Download URL: django_postgresql_ws-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic

File hashes

Hashes for django_postgresql_ws-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7388bbc1d9599587b1a3db6bfa985beace13421c19521954d39da8652f8c563d
MD5 08718e9de33147c6fcf47826a77f011c
BLAKE2b-256 2990d87375855a58d80f6deae3c742c8205a0f94fe0e44646bfa2db9df805fe2

See more details on using hashes here.

File details

Details for the file django_postgresql_ws-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_postgresql_ws-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic

File hashes

Hashes for django_postgresql_ws-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51688f8c39c0f6e2afaac456c09c01aa50cb466a3e55f6ac1e9c7cb5f233d681
MD5 f710cc863c3090e47ffafb8bfbd529ed
BLAKE2b-256 3c608a6f5405043ca04613d86a3a5292f98d5f84a0e6d9a2cd8c01cb869e8cd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page