Skip to main content

Serve SPA (Single Page Application) in django using whitenoise

Project description

whitenoise-spa

Serve SPA (Single Page Application) in django using whitenoise

Installation

You can install the package via pip:

pip install whitenoise-spa

Usage

  1. Edit your settings.py file and add whitenoise_spa.middleware.WhiteNoiseSPAMiddleware to the MIDDLEWARE list. The middleware should be placed directly after the Django SecurityMiddleware (if you are using it) and before all other middleware. This middleware replaces the whitenoise middleware.
    MIDDLEWARE = [
        # ...
        "django.middleware.security.SecurityMiddleware",
        "whitenoise_spa.middleware.WhiteNoiseSPAMiddleware",
        # ...
    ]
    
  2. Configure SPA root and urls.
    WHITENOISE_SPA_ROOT = BASE_DIR / "dist"
    WHITENOISE_SPA_URL_PATTERN = "/|/login/|/settings/"
    

License

This project is licensed under the terms of the MIT license.

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

whitenoise_spa-2.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

whitenoise_spa-2.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file whitenoise_spa-2.0.0.tar.gz.

File metadata

  • Download URL: whitenoise_spa-2.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for whitenoise_spa-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9143494b5932a963f37075652f0e22e0891a13d17f174038fe444add4263b0c1
MD5 d6cd3f29a5aa5f911cc483d071f820b9
BLAKE2b-256 ac0f6a461a36a0c6fde5cbfc0149516acf2c8afac9ea8a57bdd91ff49cbd79f5

See more details on using hashes here.

File details

Details for the file whitenoise_spa-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for whitenoise_spa-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8004e40473734cd6ecf7d62068fe5006202981978307fe7cf254fda2383ab977
MD5 543ecfb211962506275faa7a3d69509b
BLAKE2b-256 c05844e9fb565dadb2717bffd06b104d094919f7176ef75dffd6586c39c791c4

See more details on using hashes here.

Supported by

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