diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5feca28 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Remote Attach", + "type": "debugpy", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}/django", + "remoteRoot": "/django" + } + ] + } + ] +} diff --git a/django/articles/models/article.py b/django/articles/models/article.py index bfbebe5..bf24431 100644 --- a/django/articles/models/article.py +++ b/django/articles/models/article.py @@ -1,5 +1,6 @@ from django.utils import timezone from django.db import models +from django.utils.text import normalize_newlines from mdeditor.fields import MDTextField @@ -21,6 +22,7 @@ class Meta: def save(self, *args, **kwargs): self.update_date = self.create_date if self._state.adding else timezone.now() + self.content = normalize_newlines(self.content) super().save(*args, **kwargs) diff --git a/django/blog/models/post.py b/django/blog/models/post.py index a8e22bf..aa27441 100644 --- a/django/blog/models/post.py +++ b/django/blog/models/post.py @@ -1,5 +1,6 @@ from django.utils import timezone from django.db import models +from django.utils.text import normalize_newlines from mdeditor.fields import MDTextField @@ -19,6 +20,7 @@ class Meta: def save(self, *args, **kwargs): self.update_date = self.create_date if self._state.adding else timezone.now() + self.content = normalize_newlines(self.content) super().save(*args, **kwargs) diff --git a/django/dev.requirements.txt b/django/dev.requirements.txt index 8626951..4ed20d5 100644 --- a/django/dev.requirements.txt +++ b/django/dev.requirements.txt @@ -4,6 +4,29 @@ asgiref==3.8.1 ; python_full_version == "3.12.5" \ autopep8==2.3.1 ; python_full_version == "3.12.5" \ --hash=sha256:8d6c87eba648fdcfc83e29b788910b8643171c395d9c4bcf115ece035b9c9dda \ --hash=sha256:a203fe0fcad7939987422140ab17a930f684763bf7335bdb6709991dd7ef6c2d +debugpy==1.8.5 ; python_full_version == "3.12.5" \ + --hash=sha256:0a1029a2869d01cb777216af8c53cda0476875ef02a2b6ff8b2f2c9a4b04176c \ + --hash=sha256:1cd04a73eb2769eb0bfe43f5bfde1215c5923d6924b9b90f94d15f207a402226 \ + --hash=sha256:28ced650c974aaf179231668a293ecd5c63c0a671ae6d56b8795ecc5d2f48d3c \ + --hash=sha256:345d6a0206e81eb68b1493ce2fbffd57c3088e2ce4b46592077a943d2b968ca3 \ + --hash=sha256:3df6692351172a42af7558daa5019651f898fc67450bf091335aa8a18fbf6f3a \ + --hash=sha256:4413b7a3ede757dc33a273a17d685ea2b0c09dbd312cc03f5534a0fd4d40750a \ + --hash=sha256:4fbb3b39ae1aa3e5ad578f37a48a7a303dad9a3d018d369bc9ec629c1cfa7408 \ + --hash=sha256:55919dce65b471eff25901acf82d328bbd5b833526b6c1364bd5133754777a44 \ + --hash=sha256:5b5c770977c8ec6c40c60d6f58cacc7f7fe5a45960363d6974ddb9b62dbee156 \ + --hash=sha256:606bccba19f7188b6ea9579c8a4f5a5364ecd0bf5a0659c8a5d0e10dcee3032a \ + --hash=sha256:7b0fe36ed9d26cb6836b0a51453653f8f2e347ba7348f2bbfe76bfeb670bfb1c \ + --hash=sha256:7e4d594367d6407a120b76bdaa03886e9eb652c05ba7f87e37418426ad2079f7 \ + --hash=sha256:8f913ee8e9fcf9d38a751f56e6de12a297ae7832749d35de26d960f14280750a \ + --hash=sha256:a697beca97dad3780b89a7fb525d5e79f33821a8bc0c06faf1f1289e549743cf \ + --hash=sha256:ad84b7cde7fd96cf6eea34ff6c4a1b7887e0fe2ea46e099e53234856f9d99a34 \ + --hash=sha256:b2112cfeb34b4507399d298fe7023a16656fc553ed5246536060ca7bd0e668d0 \ + --hash=sha256:b78c1250441ce893cb5035dd6f5fc12db968cc07f91cc06996b2087f7cefdd8e \ + --hash=sha256:c0a65b00b7cdd2ee0c2cf4c7335fef31e15f1b7056c7fdbce9e90193e1a8c8cb \ + --hash=sha256:c9f7c15ea1da18d2fcc2709e9f3d6de98b69a5b0fff1807fb80bc55f906691f7 \ + --hash=sha256:db9fb642938a7a609a6c865c32ecd0d795d56c1aaa7a7a5722d77855d5e77f2b \ + --hash=sha256:dd3811bd63632bb25eda6bd73bea8e0521794cda02be41fa3160eb26fc29e7ed \ + --hash=sha256:e84c276489e141ed0b93b0af648eef891546143d6a48f610945416453a8ad406 django-cleanup==8.1.0 ; python_full_version == "3.12.5" \ --hash=sha256:70df905076a44e7a111b31198199af633dee08876e199e6dce36ca8dd6b8b10f \ --hash=sha256:7903873ea73b3f7e61e055340d27dba49b70634f60c87a573ad748e172836458 diff --git a/django/poetry.lock b/django/poetry.lock index f293609..faa5d4f 100644 --- a/django/poetry.lock +++ b/django/poetry.lock @@ -28,6 +28,37 @@ files = [ [package.dependencies] pycodestyle = ">=2.12.0" +[[package]] +name = "debugpy" +version = "1.8.5" +description = "An implementation of the Debug Adapter Protocol for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "debugpy-1.8.5-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:7e4d594367d6407a120b76bdaa03886e9eb652c05ba7f87e37418426ad2079f7"}, + {file = "debugpy-1.8.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4413b7a3ede757dc33a273a17d685ea2b0c09dbd312cc03f5534a0fd4d40750a"}, + {file = "debugpy-1.8.5-cp310-cp310-win32.whl", hash = "sha256:dd3811bd63632bb25eda6bd73bea8e0521794cda02be41fa3160eb26fc29e7ed"}, + {file = "debugpy-1.8.5-cp310-cp310-win_amd64.whl", hash = "sha256:b78c1250441ce893cb5035dd6f5fc12db968cc07f91cc06996b2087f7cefdd8e"}, + {file = "debugpy-1.8.5-cp311-cp311-macosx_12_0_universal2.whl", hash = "sha256:606bccba19f7188b6ea9579c8a4f5a5364ecd0bf5a0659c8a5d0e10dcee3032a"}, + {file = "debugpy-1.8.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db9fb642938a7a609a6c865c32ecd0d795d56c1aaa7a7a5722d77855d5e77f2b"}, + {file = "debugpy-1.8.5-cp311-cp311-win32.whl", hash = "sha256:4fbb3b39ae1aa3e5ad578f37a48a7a303dad9a3d018d369bc9ec629c1cfa7408"}, + {file = "debugpy-1.8.5-cp311-cp311-win_amd64.whl", hash = "sha256:345d6a0206e81eb68b1493ce2fbffd57c3088e2ce4b46592077a943d2b968ca3"}, + {file = "debugpy-1.8.5-cp312-cp312-macosx_12_0_universal2.whl", hash = "sha256:5b5c770977c8ec6c40c60d6f58cacc7f7fe5a45960363d6974ddb9b62dbee156"}, + {file = "debugpy-1.8.5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0a65b00b7cdd2ee0c2cf4c7335fef31e15f1b7056c7fdbce9e90193e1a8c8cb"}, + {file = "debugpy-1.8.5-cp312-cp312-win32.whl", hash = "sha256:c9f7c15ea1da18d2fcc2709e9f3d6de98b69a5b0fff1807fb80bc55f906691f7"}, + {file = "debugpy-1.8.5-cp312-cp312-win_amd64.whl", hash = "sha256:28ced650c974aaf179231668a293ecd5c63c0a671ae6d56b8795ecc5d2f48d3c"}, + {file = "debugpy-1.8.5-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:3df6692351172a42af7558daa5019651f898fc67450bf091335aa8a18fbf6f3a"}, + {file = "debugpy-1.8.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1cd04a73eb2769eb0bfe43f5bfde1215c5923d6924b9b90f94d15f207a402226"}, + {file = "debugpy-1.8.5-cp38-cp38-win32.whl", hash = "sha256:8f913ee8e9fcf9d38a751f56e6de12a297ae7832749d35de26d960f14280750a"}, + {file = "debugpy-1.8.5-cp38-cp38-win_amd64.whl", hash = "sha256:a697beca97dad3780b89a7fb525d5e79f33821a8bc0c06faf1f1289e549743cf"}, + {file = "debugpy-1.8.5-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:0a1029a2869d01cb777216af8c53cda0476875ef02a2b6ff8b2f2c9a4b04176c"}, + {file = "debugpy-1.8.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e84c276489e141ed0b93b0af648eef891546143d6a48f610945416453a8ad406"}, + {file = "debugpy-1.8.5-cp39-cp39-win32.whl", hash = "sha256:ad84b7cde7fd96cf6eea34ff6c4a1b7887e0fe2ea46e099e53234856f9d99a34"}, + {file = "debugpy-1.8.5-cp39-cp39-win_amd64.whl", hash = "sha256:7b0fe36ed9d26cb6836b0a51453653f8f2e347ba7348f2bbfe76bfeb670bfb1c"}, + {file = "debugpy-1.8.5-py2.py3-none-any.whl", hash = "sha256:55919dce65b471eff25901acf82d328bbd5b833526b6c1364bd5133754777a44"}, + {file = "debugpy-1.8.5.zip", hash = "sha256:b2112cfeb34b4507399d298fe7023a16656fc553ed5246536060ca7bd0e668d0"}, +] + [[package]] name = "django" version = "5.1" @@ -585,4 +616,4 @@ h11 = ">=0.9.0,<1" [metadata] lock-version = "2.0" python-versions = "3.12.5" -content-hash = "b87e0765bde87113faca03883065052238d0433b04e13144a011e41c0d39f37f" +content-hash = "11db304dc2b32f1939f9dbb5f5c66225e4a77dd74ecc610935048c8e2763386d" diff --git a/django/pyproject.toml b/django/pyproject.toml index a8adcc9..edead39 100644 --- a/django/pyproject.toml +++ b/django/pyproject.toml @@ -19,6 +19,7 @@ psycopg = {extras = ["binary"], version = "^3.2.1"} optional = true [tool.poetry.group.dev.dependencies] autopep8 = "^2.3.1" +debugpy = "^1.8.5" [tool.poetry.group.prod] optional = true diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 009d864..09331be 100755 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -44,6 +44,8 @@ services: depends_on: database: condition: service_healthy + ports: + - 5678:5678 env_file: env/django/.env volumes: - django-static:/static @@ -52,6 +54,8 @@ services: database: container_name: wokalek-database image: postgres:${DATABASE_POSTGRES_VERSION:?error} + ports: + - 5432:5432 shm_size: 256mb env_file: env/database/.env volumes: diff --git a/docker/django/dev.Dockerfile b/docker/django/dev.Dockerfile index 4da745d..8ed654c 100644 --- a/docker/django/dev.Dockerfile +++ b/docker/django/dev.Dockerfile @@ -18,4 +18,4 @@ FROM base AS entry COPY --from=static /django/static /static -ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8000"] +ENTRYPOINT ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "manage.py", "runserver", "0.0.0.0:8000"]