From f20a8e58d61eb9bbf68499414da5c2035c43039e Mon Sep 17 00:00:00 2001 From: Nehemiah60 Date: Mon, 27 Feb 2023 11:24:57 +0300 Subject: [PATCH] Added browser reload to project --- .pre-commit-config.yaml | 12 ++++++------ poetry.lock | 25 ++++++++++++++++++++----- project/core/settings.py | 2 ++ project/core/urls.py | 2 +- pyproject.toml | 2 +- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 167d70fdc..23fd4f0b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,34 +1,34 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-yaml - id: check-ast - id: check-json - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort (python) - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 + rev: v3.3.1 hooks: - id: pyupgrade - repo: https://github.com/adamchainz/django-upgrade - rev: 1.10.0 + rev: 1.13.0 hooks: - id: django-upgrade args: [--target-version, "4.1"] diff --git a/poetry.lock b/poetry.lock index 1feaa3088..82574f536 100644 --- a/poetry.lock +++ b/poetry.lock @@ -43,7 +43,7 @@ python-versions = ">=3.5" dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] -tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] +tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] [[package]] name = "backcall" @@ -100,7 +100,7 @@ optional = false python-versions = ">=3.6.0" [package.extras] -unicode-backport = ["unicodedata2"] +unicode_backport = ["unicodedata2"] [[package]] name = "click" @@ -165,6 +165,17 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "django-browser-reload" +version = "1.7.0" +description = "Automatically reload your browser in development." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +Django = ">=3.2" + [[package]] name = "django-cors-headers" version = "3.13.0" @@ -374,7 +385,7 @@ notebook = ["ipywidgets", "notebook"] parallel = ["ipyparallel"] qtconsole = ["qtconsole"] test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] -test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] +test_extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] [[package]] name = "jedi" @@ -693,7 +704,7 @@ urllib3 = ">=1.21.1,<1.27" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "setuptools" @@ -843,7 +854,7 @@ brotli = ["Brotli"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "0af7af261656ea66206a523ff3ca9d7ede70ffe6ab49092cf0c9360bc3b59a65" +content-hash = "fa0c551557394e75a6c89769942547573581e41de41dd803663696f0d51baa6b" [metadata.files] appnope = [ @@ -973,6 +984,10 @@ Django = [ {file = "Django-4.1.2-py3-none-any.whl", hash = "sha256:26dc24f99c8956374a054bcbf58aab8dc0cad2e6ac82b0fe036b752c00eee793"}, {file = "Django-4.1.2.tar.gz", hash = "sha256:b8d843714810ab88d59344507d4447be8b2cf12a49031363b6eed9f1b9b2280f"}, ] +django-browser-reload = [ + {file = "django_browser_reload-1.7.0-py3-none-any.whl", hash = "sha256:0d7cc4308ebbdf9b5637e28ee7b41ae28d4fcdf350d55ce007515b44cd10291b"}, + {file = "django_browser_reload-1.7.0.tar.gz", hash = "sha256:712d0a4d6caa6833c8c205d4ce177b474feb45583cd6ee684c9ea7b71dd921b6"}, +] django-cors-headers = [ {file = "django-cors-headers-3.13.0.tar.gz", hash = "sha256:f9dc6b4e3f611c3199700b3e5f3398c28757dcd559c2f82932687f3d0443cfdf"}, {file = "django_cors_headers-3.13.0-py3-none-any.whl", hash = "sha256:37e42883b5f1f2295df6b4bba96eb2417a14a03270cb24b2a07f021cd4487cf4"}, diff --git a/project/core/settings.py b/project/core/settings.py index 256587ac5..5bcb65124 100644 --- a/project/core/settings.py +++ b/project/core/settings.py @@ -36,6 +36,7 @@ "categories", "notification", "debug_toolbar", + "django_browser_reload", ) MIDDLEWARE = [ @@ -50,6 +51,7 @@ # 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", + "django_browser_reload.middleware.BrowserReloadMiddleware", ] INTERNAL_IPS = [ diff --git a/project/core/urls.py b/project/core/urls.py index a8c891097..b87c3a007 100644 --- a/project/core/urls.py +++ b/project/core/urls.py @@ -13,7 +13,6 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ - from core.router import CiviWikiRouter from django.conf import settings from django.conf.urls.static import static @@ -47,6 +46,7 @@ ), re_path(r"^media/(?P.*)$", serve, {"document_root": settings.MEDIA_ROOT}), path("__debug__/", include("debug_toolbar.urls")), + path("__reload__/", include("django_browser_reload.urls")), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/pyproject.toml b/pyproject.toml index 850ee415b..e5bc9e1e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ psycopg2-binary = "^2.9.3" django-taggit = "^3.0.0" Pillow = "^9.2.0" requests = "^2.28.1" - +django-browser-reload = "^1.7.0" [tool.poetry.dev-dependencies] black = "^22.6.0" coverage = "^6.4.4"