Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamchainz/django-browser-reload
Automatically reload your browser in development.
https://github.com/adamchainz/django-browser-reload
Last synced: about 1 month ago
JSON representation
Automatically reload your browser in development.
- Host: GitHub
- URL: https://github.com/adamchainz/django-browser-reload
- Owner: adamchainz
- License: mit
- Created: 2021-12-14T23:01:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T23:32:38.000Z (8 months ago)
- Last Synced: 2024-05-01T12:53:13.486Z (8 months ago)
- Language: Python
- Homepage:
- Size: 497 KB
- Stars: 456
- Watchers: 5
- Forks: 21
- Open Issues: 17
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
- stars - adamchainz/django-browser-reload - Automatically reload your browser in development. (Python)
- stars - adamchainz/django-browser-reload - Automatically reload your browser in development. (Python)
README
=====================
django-browser-reload
=====================.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/django-browser-reload/main.yml.svg?branch=main&style=for-the-badge
:target: https://github.com/adamchainz/django-browser-reload/actions?workflow=CI.. image:: https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge
:target: https://github.com/adamchainz/django-browser-reload/actions?workflow=CI.. image:: https://img.shields.io/pypi/v/django-browser-reload.svg?style=for-the-badge
:target: https://pypi.org/project/django-browser-reload/.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
:target: https://github.com/psf/black.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commitAutomatically reload your browser in development.
----
**Work smarter and faster** with my book `Boost Your Django DX `__ which covers django-browser-reload and many other tools.
I wrote django-browser-reload whilst working on the book!----
Requirements
------------Python 3.9 to 3.13 supported.
Django 4.2 to 5.1 supported.
WSGI supported on all Django versions. ASGI supported on Django 4.2+.
Your browser needs to support:
* |EventSource|__ - universally available.
.. |EventSource| replace:: ``EventSource``
__ https://developer.mozilla.org/en-US/docs/Web/API/EventSource#browser_compatibility* |SharedWorker|__ - available on Chrome, Edge, Firefox, and Opera for a long time.
Available on Safari since version 16 (2022-09-12)... |SharedWorker| replace:: ``SharedWorker``
__ https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker#browser_compatibilityInstallation
------------1. Install with **pip**:
.. code-block:: sh
python -m pip install django-browser-reload
2. Ensure you have ``"django.contrib.staticfiles"`` in your ``INSTALLED_APPS``.
3. Add django-browser-reload to your ``INSTALLED_APPS``:
.. code-block:: python
INSTALLED_APPS = [
...,
"django_browser_reload",
...,
]4. Include the app URLs in your root URLconf:
.. code-block:: python
from django.urls import include, path
urlpatterns = [
...,
path("__reload__/", include("django_browser_reload.urls")),
]You can use another prefix if required.
5. Add the middleware:
.. code-block:: python
MIDDLEWARE = [
# ...
"django_browser_reload.middleware.BrowserReloadMiddleware",
# ...
]The middleware should be listed after any others that encode the response, such as Django’s ``GZipMiddleware``.
The middleware automatically inserts the required script tag on HTML responses before ``