https://github.com/sandbox-pokhara/whitenoise-spa
Serve SPA (Single Page Application) in django using whitenoise
https://github.com/sandbox-pokhara/whitenoise-spa
django react spa static vue whitenoise
Last synced: 6 months ago
JSON representation
Serve SPA (Single Page Application) in django using whitenoise
- Host: GitHub
- URL: https://github.com/sandbox-pokhara/whitenoise-spa
- Owner: sandbox-pokhara
- License: mit
- Created: 2024-08-06T08:00:02.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-10T05:56:50.000Z (11 months ago)
- Last Synced: 2025-03-20T10:47:24.471Z (7 months ago)
- Topics: django, react, spa, static, vue, whitenoise
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```python
MIDDLEWARE = [
# ...
"django.middleware.security.SecurityMiddleware",
"whitenoise_spa.middleware.WhiteNoiseSPAMiddleware",
# ...
]
```
2. Configure SPA root and urls.
```python
WHITENOISE_SPA_ROOT = BASE_DIR / "dist"
WHITENOISE_SPA_URL_PATTERN = "/|/login/|/settings/"
```## License
This project is licensed under the terms of the MIT license.