Add livereloading of browser

This commit is contained in:
Jake Howard 2022-06-13 22:43:54 +01:00
parent d4c7b34a15
commit c9f5b6fb3a
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 9 additions and 0 deletions

View file

@ -5,3 +5,4 @@ django-stubs[compatible-mypy]==1.11.0
flake8==4.0.1 flake8==4.0.1
isort==5.10.1 isort==5.10.1
black==22.3.0 black==22.3.0
django-browser-reload==1.6.0

View file

@ -130,3 +130,8 @@ WAGTAILSEARCH_BACKENDS = {
BASE_HOSTNAME = env("BASE_HOSTNAME") BASE_HOSTNAME = env("BASE_HOSTNAME")
WAGTAILADMIN_BASE_URL = f"https://{BASE_HOSTNAME}" WAGTAILADMIN_BASE_URL = f"https://{BASE_HOSTNAME}"
# Add `django-browser-reload`
if DEBUG:
INSTALLED_APPS.append("django_browser_reload")
MIDDLEWARE.append("django_browser_reload.middleware.BrowserReloadMiddleware")

View file

@ -21,6 +21,9 @@ if settings.DEBUG:
# Serve media files from development server # Serve media files from development server
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# Add django-browser-reload
urlpatterns.append(path("__reload__/", include("django_browser_reload.urls")))
urlpatterns = urlpatterns + [ urlpatterns = urlpatterns + [
# For anything not caught by a more specific rule above, hand over to # For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in # Wagtail's page serving mechanism. This should be the last pattern in