mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-11-28 12:53:04 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| daff99510f | |||
| cff1705a9f | |||
| d15810d8b2 | |||
| 9e9fed767e | |||
| 58fedcec48 | |||
| 39f59b99ae | |||
| 767e3e0436 |
@@ -10,9 +10,11 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -21,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', get_random_secret_key())
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||
@@ -172,4 +174,4 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
VERSION = "v2.0.0"
|
||||
VERSION = "v2.0.2"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import os
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
from django_celery_beat.models import IntervalSchedule, PeriodicTask
|
||||
|
||||
from wol.models import Settings, Websocket
|
||||
@@ -19,7 +18,11 @@ Websocket.objects.create(visitors=0)
|
||||
|
||||
# ping interval
|
||||
if os.environ.get("PING_INTERVAL"):
|
||||
ping_interval = os.environ.get("PING_INTERVAL")
|
||||
if int(os.environ.get("PING_INTERVAL")) < 5:
|
||||
print("Ping interval lower than 5 seconds is not recommended. Please use an interval of 5 seconds or higher. Automatically set to 5 seconds.")
|
||||
ping_interval = 5
|
||||
else:
|
||||
ping_interval = int(os.environ.get("PING_INTERVAL"))
|
||||
else:
|
||||
ping_interval = 5
|
||||
Settings.objects.update_or_create(
|
||||
|
||||
@@ -5,6 +5,7 @@ import threading
|
||||
from asgiref.sync import async_to_sync
|
||||
from celery import shared_task
|
||||
from channels.layers import get_channel_layer
|
||||
from django.db import connection
|
||||
from django_celery_beat.models import CrontabSchedule, PeriodicTask
|
||||
|
||||
from wol.commands import shutdown, wake
|
||||
@@ -90,6 +91,8 @@ class WolDevice:
|
||||
"message": data
|
||||
}})
|
||||
|
||||
connection.close()
|
||||
|
||||
|
||||
@shared_task
|
||||
def ping_all_devices():
|
||||
|
||||
Generated
+202
-3797
File diff suppressed because it is too large
Load Diff
@@ -23,8 +23,8 @@
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"bootstrap": "^5.1.3",
|
||||
"dotenv": "^16.0.0",
|
||||
"node-sass": "^7.0.1",
|
||||
"postcss": "^8.4.6",
|
||||
"sass": "^1.49.9",
|
||||
"sirv-cli": "^2.0.0",
|
||||
"svelte-preprocess": "^4.10.3"
|
||||
}
|
||||
|
||||
+1
-17
@@ -1,23 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# set ping interval
|
||||
if [ -z "$PING_INTERVAL" ]; then
|
||||
PING_INTERVAL=5
|
||||
elif [ "$PING_INTERVAL" -lt 5 ]; then
|
||||
echo ""
|
||||
echo "Ping interval lower than 5 seconds is not recommended. Please use an interval of 5 seconds or higher. Automatically set to 5 seconds."
|
||||
echo ""
|
||||
PING_INTERVAL=5
|
||||
fi
|
||||
|
||||
# create django secret key
|
||||
cd /app/backend/ || exit
|
||||
if [ -z "$DJANGO_SECRET_KEY" ]; then
|
||||
DJANGO_SECRET_KEY=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
|
||||
export DJANGO_SECRET_KEY
|
||||
fi
|
||||
|
||||
# init django
|
||||
cd /app/backend/ || exit
|
||||
python3 manage.py makemigrations
|
||||
python3 manage.py migrate
|
||||
python3 manage.py collectstatic --noinput
|
||||
|
||||
@@ -39,7 +39,7 @@ services:
|
||||
interval: 10s
|
||||
mysql:
|
||||
container_name: upsnap_mysql
|
||||
image: mysql
|
||||
image: mariadb
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
Reference in New Issue
Block a user