diff --git a/.gitignore b/.gitignore index b6350f8..5982670 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ db.sqlite3 db.sqlite3-journal resources/media resources/static +resources/logs # 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. # /staticfiles/ diff --git a/config/conf/__init__.py b/config/conf/__init__.py index 58d4b54..38d5c40 100644 --- a/config/conf/__init__.py +++ b/config/conf/__init__.py @@ -2,3 +2,4 @@ from .djangorestframework import * from .simple_jwt import * from .jazzmin import * from .cors_headers import * +from .logs import * \ No newline at end of file diff --git a/config/conf/logs.py b/config/conf/logs.py new file mode 100644 index 0000000..4e94604 --- /dev/null +++ b/config/conf/logs.py @@ -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, + }, + }, +} \ No newline at end of file diff --git a/resources/scripts/entrypoint-server.sh b/resources/scripts/entrypoint-server.sh index b1c9cb5..ad5c608 100644 --- a/resources/scripts/entrypoint-server.sh +++ b/resources/scripts/entrypoint-server.sh @@ -1,4 +1,6 @@ #!/bin/bash +mkdir -p resources/logs + python3 manage.py collectstatic --noinput python3 manage.py migrate --noinput diff --git a/resources/scripts/entrypoint.sh b/resources/scripts/entrypoint.sh index fcc25c6..f0abb2c 100644 --- a/resources/scripts/entrypoint.sh +++ b/resources/scripts/entrypoint.sh @@ -1,4 +1,6 @@ #!/bin/bash +mkdir -p resources/logs + python3 manage.py collectstatic --noinput python3 manage.py migrate --noinput