add runtime info to dashboard
This commit is contained in:
parent
902bb1f26f
commit
182d9d494a
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row no-margin-bottom">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 xl3">
|
||||
<div class="card dashcard">
|
||||
<a href="{% url 'sync:sources' %}">
|
||||
|
@ -99,4 +99,31 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h2 class="truncate">Runtime infomation</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<table class="striped">
|
||||
<tr title="User ID TubeSync is running under">
|
||||
<td class="hide-on-small-only">User ID</td>
|
||||
<td><span class="hide-on-med-and-up">User ID<br></span><strong>{{ uid }}</strong></td>
|
||||
</tr>
|
||||
<tr title="Group ID TubeSync is running under">
|
||||
<td class="hide-on-small-only">Group ID</td>
|
||||
<td><span class="hide-on-med-and-up">Group ID<br></span><strong>{{ gid }}</strong></td>
|
||||
</tr>
|
||||
<tr title="Local directory where configuration data is stored">
|
||||
<td class="hide-on-small-only">Config directory</td>
|
||||
<td><span class="hide-on-med-and-up">Config directory<br></span><strong>{{ config_dir }}</strong></td>
|
||||
</tr>
|
||||
<tr title="Local directory where media will be downloaded to">
|
||||
<td class="hide-on-small-only">Downloads directory</td>
|
||||
<td><span class="hide-on-med-and-up">Downloads directory<br></span><strong>{{ downloads_dir }}</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import json
|
||||
from base64 import b64decode
|
||||
from django.conf import settings
|
||||
|
@ -71,6 +72,12 @@ class DashboardView(TemplateView):
|
|||
data['largest_downloads'] = Media.objects.filter(
|
||||
downloaded=True, downloaded_filesize__isnull=False
|
||||
).order_by('-downloaded_filesize')[:10]
|
||||
# UID and GID
|
||||
data['uid'] = os.getuid()
|
||||
data['gid'] = os.getgid()
|
||||
# Config and download locations
|
||||
data['config_dir'] = str(settings.CONFIG_BASE_DIR)
|
||||
data['downloads_dir'] = str(settings.DOWNLOAD_ROOT)
|
||||
return data
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ from binascii import hexlify
|
|||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
ROOT_DIR = Path('/')
|
||||
CONFIG_BASE_DIR = ROOT_DIR / 'config'
|
||||
DOWNLOADS_BASE_DIR = ROOT_DIR / 'downloads'
|
||||
|
||||
|
||||
RANDOM_SECRET = hexlify(os.urandom(32)).decode()
|
||||
|
@ -19,10 +21,10 @@ TIME_ZONE = os.getenv('TZ', 'UTC')
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': ROOT_DIR / 'config' / 'db.sqlite3',
|
||||
'NAME': CONFIG_BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MEDIA_ROOT = ROOT_DIR / 'config' / 'media'
|
||||
DOWNLOAD_ROOT = ROOT_DIR / 'downloads'
|
||||
MEDIA_ROOT = CONFIG_BASE_DIR / 'media'
|
||||
DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR
|
||||
|
|
|
@ -2,6 +2,8 @@ from pathlib import Path
|
|||
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
CONFIG_BASE_DIR = BASE_DIR
|
||||
DOWNLOADS_BASE_DIR = BASE_DIR
|
||||
|
||||
|
||||
SECRET_KEY = 'example-secret-key'
|
||||
|
@ -11,9 +13,9 @@ DEBUG = False
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'NAME': CONFIG_BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DOWNLOAD_ROOT = BASE_DIR / 'downloads'
|
||||
DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR / 'downloads'
|
||||
|
|
|
@ -2,6 +2,8 @@ from pathlib import Path
|
|||
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
CONFIG_BASE_DIR = BASE_DIR
|
||||
DOWNLOADS_BASE_DIR = BASE_DIR
|
||||
|
||||
|
||||
VERSION = 0.1
|
||||
|
@ -98,8 +100,8 @@ USE_TZ = True
|
|||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR / 'static'
|
||||
#MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
DOWNLOAD_ROOT = BASE_DIR / 'downloads'
|
||||
MEDIA_ROOT = CONFIG_BASE_DIR / 'media'
|
||||
DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR / 'downloads'
|
||||
DOWNLOAD_VIDEO_DIR = 'video'
|
||||
DOWNLOAD_AUDIO_DIR = 'audio'
|
||||
SASS_PROCESSOR_ROOT = STATIC_ROOT
|
||||
|
|
Loading…
Reference in New Issue