diff --git a/cvat/apps/tf_annotation/views.py b/cvat/apps/tf_annotation/views.py index bcbc94eb2460..daaa9765ee48 100644 --- a/cvat/apps/tf_annotation/views.py +++ b/cvat/apps/tf_annotation/views.py @@ -21,7 +21,7 @@ import tensorflow as tf import numpy as np from PIL import Image -from .log import slogger +from cvat.apps.engine.log import slogger def load_image_into_numpy(image): (im_width, im_height) = image.size diff --git a/cvat/settings/base.py b/cvat/settings/base.py index 1eb21aa2f50b..452843d5204a 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -189,6 +189,7 @@ 'handlers': { 'console': { 'class': 'logging.StreamHandler', + 'filters': [], 'formatter': 'standard', }, 'server_file': { @@ -222,6 +223,11 @@ 'revproxy': { 'handlers': ['console', 'server_file'], 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG') + }, + 'django': { + 'handlers': ['console', 'server_file'], + 'level': 'INFO', + 'propagate': True } }, } diff --git a/cvat/urls.py b/cvat/urls.py index 2e4f049856d5..5d915cb9b90f 100644 --- a/cvat/urls.py +++ b/cvat/urls.py @@ -22,6 +22,7 @@ from django.urls import path, include from django.conf import settings from django.conf.urls.static import static +from django.apps import apps import os urlpatterns = [ @@ -30,9 +31,11 @@ path('dashboard/', include('cvat.apps.dashboard.urls')), path('django-rq/', include('django_rq.urls')), path('auth/', include('cvat.apps.authentication.urls')), - path('documentation/', include('cvat.apps.documentation.urls')), - path('analytics/', include('cvat.apps.log_viewer.urls')) + path('documentation/', include('cvat.apps.documentation.urls')) ] -if 'yes' == os.environ.get('TF_ANNOTATION', 'no'): - urlpatterns += [path('tf_annotation/', include('cvat.apps.tf_annotation.urls'))] +if apps.is_installed('cvat.apps.tf_annotation'): + urlpatterns.append(path('tf_annotation/', include('cvat.apps.tf_annotation.urls'))) + +if apps.is_installed('cvat.apps.log_viewer'): + urlpatterns.append(path('analytics/', include('cvat.apps.log_viewer.urls'))) diff --git a/supervisord.conf b/supervisord.conf index 87020e5b8a09..2aa7f92fd203 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -29,8 +29,14 @@ command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \ numprocs=1 [program:runserver] +; Here need to run a couple of commands to initialize DB and copy static files. +; We cannot initialize DB on build because the DB should be online. Also some +; apps are dynamically loaded by an environment variable. It can lead to issues +; with docker cache. Thus it is necessary to run collectstatic here for such +; apps. command=%(ENV_HOME)s/wait-for-it.sh db:5432 -t 0 -- bash -ic \ "/usr/bin/python3 ~/manage.py migrate && \ + /usr/bin/python3 ~/manage.py collectstatic --no-input && \ exec /usr/bin/python3 $HOME/manage.py runmodwsgi --log-to-terminal --port 8080 \ --limit-request-body 1073741824 --log-level INFO --include-file ~/mod_wsgi.conf \ %(ENV_DJANGO_MODWSGI_EXTRA_ARGS)s --locale %(ENV_LC_ALL)s"