config/conf/logs.py: logs file qo'shildi, muntazam ravishda loglarni yozib borish uchun

This commit is contained in:
behruz-dev
2025-12-05 16:26:44 +05:00
parent f8af606ca9
commit d8f4e44102
5 changed files with 33 additions and 0 deletions

1
.gitignore vendored
View File

@@ -11,6 +11,7 @@ db.sqlite3
db.sqlite3-journal db.sqlite3-journal
resources/media resources/media
resources/static resources/static
resources/logs
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly. # in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/ # <django-project-name>/staticfiles/

View File

@@ -2,3 +2,4 @@ from .djangorestframework import *
from .simple_jwt import * from .simple_jwt import *
from .jazzmin import * from .jazzmin import *
from .cors_headers import * from .cors_headers import *
from .logs import *

27
config/conf/logs.py Normal file
View File

@@ -0,0 +1,27 @@
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"format": "{levelname} {asctime} {module} {message}",
"style": "{",
},
},
"handlers": {
"daily_rotating_file": {
"level": "INFO",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "resources/logs/django.log",
"when": "midnight",
"backupCount": 30,
"formatter": "verbose",
},
},
"loggers": {
"django": {
"handlers": ["daily_rotating_file"],
"level": "INFO",
"propagate": True,
},
},
}

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
mkdir -p resources/logs
python3 manage.py collectstatic --noinput python3 manage.py collectstatic --noinput
python3 manage.py migrate --noinput python3 manage.py migrate --noinput

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
mkdir -p resources/logs
python3 manage.py collectstatic --noinput python3 manage.py collectstatic --noinput
python3 manage.py migrate --noinput python3 manage.py migrate --noinput