Skip to main content

django-pwa

Library for adding progressive web app functionality in your django project.

Table of content

Introduction

This Django library adds progressive web app functionality in your django project.

When you open your site from your mobile browser, will prompt you to add the site to your home screen as an application.

Installing

pip install django-progressive

Configuration

Add django-progressive django_pwa to your installed apps INSTALLED_APPS in django settings.py

INSTALLED_APPS = [
    '...',
    'django_pwa'
    '...'
]

Define STATICFILES_DIRS

In settings.py using the prefix PWA_ and the keys from the web app manifest all in capital you can configure the pwa manifest.

PWA_NAME = 'test app'
PWA_SHORT_NAME = 'test_app'
PWA_ICONS = [
    {
        "src": "/static/icons/icon-128x128.png",
        "sizes": "128x128",
        "type": "image/png"
    }, {
        "src": "/static/icons/icon-144x144.png",
        "sizes": "144x144",
        "type": "image/png"
    }, {
        "src": "/static/icons/icon-152x152.png",
        "sizes": "152x152",
        "type": "image/png"
    }, {
        "src": "/static/icons/icon-192x192.png",
        "sizes": "192x192",
        "type": "image/png"
    }, {
        "src": "/static/icons/icon-256x256.png",
        "sizes": "256x256",
        "type": "image/png"
    }, {
        "src": "/static/icons/icon-512x512.png",
        "sizes": "512x512",
        "type": "image/png"
    }
]

You can change the default worker location with PWA_WORKER_LOCATION.

PWA_WORKER_LOCATION = join('static', 'django_pwa_demo', 'service-worker.js')

Usage

Add django_pwa urls to your urls.py

from django.urls import path, include

urlpatterns = [
    '...',
    path('', include('django_pwa.urls')),
    '...'
]

You can add {% load pwa_extras %} to use {% load_manifest %} template tag to load the manifest.json and {% load_worker %} to load the worker-app.js.

{% load pwa_extras %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>PWA Test</title>
    {% load_manifest %}
</head>
<body>
<h1>Hello world!!!</h1>

{% load_worker %}
</body>
</html>

Metadata

Release files for django-progressive 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-progressive 1.0.4
File Size Uploaded Provenance Actions
django-progressive-1.0.4.tar.gz 4.9 kB Without provenance Details for django-progressive-1.0.4.tar.gz

Release files / django-progressive-1.0.4.tar.gz

Download URL django-progressive-1.0.4.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
daf981f707bede9be907808c5d2fd4bc99cf23bd0c491aea793bb0b7cb139a0c
BLAKE2b-256 checksum
How to use checksums
70971169440167ef085ecbf53ee5594ceedd1150aaf78187cf0c22ec55ce2a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

Security for django-progressive 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page