diff --git a/Makefile b/Makefile index d0cf738..9ddbd63 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,12 @@ -PHONY: install run virtualenv ipython clean test pflake8 fmt lint live - +PHONY: install run virtualenv ipython clean test pflake8 fmt lint install: @echo "Installing for dev environment" @.venv/bin/python -m pip install -e '.[test,dev]' - virtualenv: @python -m venv .venv - -live: - @python manage.py livereload - - run: @python manage.py runserver @@ -21,11 +14,9 @@ run: ipython: @.venv/bin/ipython - test: @.venv/bin/pytest -vs -s - lint: @.venv/bin/pflake8 app kamila_project diff --git a/kamila_project/settings.py b/kamila_project/settings.py index 6b6b65c..055a4f0 100644 --- a/kamila_project/settings.py +++ b/kamila_project/settings.py @@ -9,7 +9,6 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.1/ref/settings/ """ - from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -40,7 +39,7 @@ "django.contrib.messages", "django.contrib.staticfiles", "app", - # "livereload", + "django_browser_reload", ] MIDDLEWARE = [ @@ -51,7 +50,7 @@ "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", - # "livereload.middleware.LiveReloadScript", + "django_browser_reload.middleware.BrowserReloadMiddleware", ] ROOT_URLCONF = "kamila_project.urls" diff --git a/kamila_project/urls.py b/kamila_project/urls.py index 33c75fe..afb1c3b 100644 --- a/kamila_project/urls.py +++ b/kamila_project/urls.py @@ -2,6 +2,7 @@ from django.urls import path from app import views +from django.urls import include, path urlpatterns = [ path("post/", views.post, name="post"), @@ -9,4 +10,5 @@ path("index/", views.index, name="index"), path("admin/", admin.site.urls), path("", views.index, name="index"), + path("__reload__/", include("django_browser_reload.urls")), ] diff --git a/pyproject.toml b/pyproject.toml index fb155a9..6597edc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ dependencies = [ [tool.setuptools.packages] find = { where = ["app", "kamila_project"] } - [project.optional-dependencies] test = [ "flake8", @@ -22,7 +21,7 @@ test = [ "isort", "pytest", "pytest-django", - # "livereload", + "django-browser-reload", ] [tool.flake8] diff --git a/requirements.dev.txt b/requirements.dev.txt index 4dae840..bb24a55 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -5,11 +5,8 @@ pudb pytest pytest-watch - -# auto reload -# django-livereload -# django-livereload-server - +# auto reload front-end +django-browser-reload # Code Quality flake8