From d18b4c0756f9c33ba8eaaa3967f9207e5df76f80 Mon Sep 17 00:00:00 2001 From: Victor Magueta <56882461+vmagueta@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:59:55 +0000 Subject: [PATCH] Setup (#10) * reorganized the folders, created the initial setup, and created the base html * added the make live command * fixed missing the command in PHONY * Created pipeline for CI, fixed the requirements of the project and make a new test for testing CI * Created pipeline for CI, fixed the requirements of the project and make a new test for testing CI * Fixed the error of requirements.test.txt and removed livereload untill find a way to use it with tests * Fixed the error of missing pflake on requirements * Fixed the test, removed --forked from test * Configured a new Hot Reload for front-end --- Makefile | 11 +---------- kamila_project/settings.py | 5 ++--- kamila_project/urls.py | 2 ++ pyproject.toml | 3 +-- requirements.dev.txt | 7 ++----- 5 files changed, 8 insertions(+), 20 deletions(-) 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