Skip to content

Commit

Permalink
fix(django): попытка пофиксить ошибку «Hydration completed but contai…
Browse files Browse the repository at this point in the history
…ns mismatches»

Также установил debugpy, создал профиль для дебагинга внутри контейнера
  • Loading branch information
wokalek committed Aug 24, 2024
1 parent dbc61b2 commit 3290b9e
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
2 changes: 2 additions & 0 deletions django/articles/models/article.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions django/blog/models/post.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

Expand Down
23 changes: 23 additions & 0 deletions django/dev.requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 32 additions & 1 deletion django/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions django/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ services:
depends_on:
database:
condition: service_healthy
ports:
- 5678:5678
env_file: env/django/.env
volumes:
- django-static:/static
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docker/django/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 3290b9e

Please sign in to comment.