this is really neat, but is it safe?
This commit is contained in:
1 parent
7d8562b1d4
commit
c7726fda01
2 files changed
+19
-1
No files matched your search
@@ -1,3 +1,6 @@
|
||||
[inet_http_server] ; inet (TCP) server disabled by default
|
||||
port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
|
||||
|
||||
[supervisord]
|
||||
nodaemon=true ; start in foreground if true; default false
|
||||
logfile=/var/log/supervisord/supervisord.log ; main log file; default $CWD/supervisord.log
|
||||
@@ -6,6 +9,9 @@ logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
|
||||
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
|
||||
loglevel=info ; log level; default info; others: debug,warn,trace
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[program:gunicorn]
|
||||
command=gunicorn -c /usr/src/paperless/gunicorn.conf.py -b 0.0.0.0:8000 paperless.wsgi
|
||||
user=paperless
|
||||
|
||||
+13
-1
@@ -1,3 +1,6 @@
|
||||
import json
|
||||
from xmlrpc.client import ServerProxy
|
||||
|
||||
from django.db.models import Count, Max
|
||||
from django.http import HttpResponse, HttpResponseBadRequest
|
||||
from django.views.decorators.cache import cache_control
|
||||
@@ -229,6 +232,14 @@ class SearchAutoCompleteView(APIView):
|
||||
return Response([])
|
||||
|
||||
|
||||
def get_consumer_status():
|
||||
try:
|
||||
server = ServerProxy('http://localhost:9001/RPC2')
|
||||
return server.supervisor.getProcessInfo('consumer')
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
class StatisticsView(APIView):
|
||||
|
||||
permission_classes = (IsAuthenticated,)
|
||||
@@ -236,5 +247,6 @@ class StatisticsView(APIView):
|
||||
def get(self, request, format=None):
|
||||
return Response({
|
||||
'documents_total': Document.objects.all().count(),
|
||||
'documents_inbox': Document.objects.filter(tags__is_inbox_tag=True).distinct().count()
|
||||
'documents_inbox': Document.objects.filter(tags__is_inbox_tag=True).distinct().count(),
|
||||
'consumer_status': get_consumer_status()
|
||||
})
|
||||
Reference in new issue
Block a user