Skip to content

Commit

Permalink
Fix several problems with analytics. (cvat-ai#129)
Browse files Browse the repository at this point in the history
- collectstatic always
- conditionally urls for cvat.apps.log_viewer
- more logs from django in production
  • Loading branch information
nmanovic authored Oct 15, 2018
1 parent 45af7bd commit 70891f0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cvat/apps/tf_annotation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'filters': [],
'formatter': 'standard',
},
'server_file': {
Expand Down Expand Up @@ -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
}
},
}
Expand Down
11 changes: 7 additions & 4 deletions cvat/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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')))
6 changes: 6 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 70891f0

Please sign in to comment.