Fix several problems with analytics. (#129)

- collectstatic always
- conditionally urls for cvat.apps.log_viewer
- more logs from django in production
main
Nikita Manovich 7 years ago committed by GitHub
parent 45af7bdee3
commit 70891f0020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,7 +21,7 @@ import rq
import tensorflow as tf import tensorflow as tf
import numpy as np import numpy as np
from PIL import Image from PIL import Image
from .log import slogger from cvat.apps.engine.log import slogger
def load_image_into_numpy(image): def load_image_into_numpy(image):
(im_width, im_height) = image.size (im_width, im_height) = image.size

@ -189,6 +189,7 @@ LOGGING = {
'handlers': { 'handlers': {
'console': { 'console': {
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'filters': [],
'formatter': 'standard', 'formatter': 'standard',
}, },
'server_file': { 'server_file': {
@ -222,6 +223,11 @@ LOGGING = {
'revproxy': { 'revproxy': {
'handlers': ['console', 'server_file'], 'handlers': ['console', 'server_file'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG') 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG')
},
'django': {
'handlers': ['console', 'server_file'],
'level': 'INFO',
'propagate': True
} }
}, },
} }

@ -22,6 +22,7 @@ from django.contrib import admin
from django.urls import path, include from django.urls import path, include
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.apps import apps
import os import os
urlpatterns = [ urlpatterns = [
@ -30,9 +31,11 @@ urlpatterns = [
path('dashboard/', include('cvat.apps.dashboard.urls')), path('dashboard/', include('cvat.apps.dashboard.urls')),
path('django-rq/', include('django_rq.urls')), path('django-rq/', include('django_rq.urls')),
path('auth/', include('cvat.apps.authentication.urls')), path('auth/', include('cvat.apps.authentication.urls')),
path('documentation/', include('cvat.apps.documentation.urls')), path('documentation/', include('cvat.apps.documentation.urls'))
path('analytics/', include('cvat.apps.log_viewer.urls'))
] ]
if 'yes' == os.environ.get('TF_ANNOTATION', 'no'): if apps.is_installed('cvat.apps.tf_annotation'):
urlpatterns += [path('tf_annotation/', include('cvat.apps.tf_annotation.urls'))] 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')))

@ -29,8 +29,14 @@ command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \
numprocs=1 numprocs=1
[program:runserver] [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 \ 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 migrate && \
/usr/bin/python3 ~/manage.py collectstatic --no-input && \
exec /usr/bin/python3 $HOME/manage.py runmodwsgi --log-to-terminal --port 8080 \ 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 \ --limit-request-body 1073741824 --log-level INFO --include-file ~/mod_wsgi.conf \
%(ENV_DJANGO_MODWSGI_EXTRA_ARGS)s --locale %(ENV_LC_ALL)s" %(ENV_DJANGO_MODWSGI_EXTRA_ARGS)s --locale %(ENV_LC_ALL)s"

Loading…
Cancel
Save