forked from 0x2620/pandora
remove config reloader
This commit is contained in:
parent
7ab789f80a
commit
63d82ad7e7
13 changed files with 0 additions and 72 deletions
|
@ -24,9 +24,6 @@ User = get_user_model()
|
||||||
|
|
||||||
_win = (sys.platform == "win32")
|
_win = (sys.platform == "win32")
|
||||||
|
|
||||||
RUN_RELOADER = True
|
|
||||||
NOTIFIER = None
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
git_dir = join(dirname(dirname(dirname(__file__))), '.git')
|
git_dir = join(dirname(dirname(dirname(__file__))), '.git')
|
||||||
if exists(git_dir):
|
if exists(git_dir):
|
||||||
|
@ -258,45 +255,6 @@ check the README for further details.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def reloader_thread():
|
|
||||||
global NOTIFIER
|
|
||||||
settings.RELOADER_RUNNING=True
|
|
||||||
_config_mtime = 0
|
|
||||||
try:
|
|
||||||
import pyinotify
|
|
||||||
INOTIFY = True
|
|
||||||
except:
|
|
||||||
INOTIFY = False
|
|
||||||
if INOTIFY:
|
|
||||||
def add_watch():
|
|
||||||
name = os.path.realpath(settings.SITE_CONFIG)
|
|
||||||
wm.add_watch(name, pyinotify.IN_CLOSE_WRITE, reload_config)
|
|
||||||
|
|
||||||
def reload_config(event):
|
|
||||||
load_config()
|
|
||||||
add_watch()
|
|
||||||
|
|
||||||
wm = pyinotify.WatchManager()
|
|
||||||
add_watch()
|
|
||||||
notifier = pyinotify.Notifier(wm)
|
|
||||||
NOTIFIER = notifier
|
|
||||||
notifier.loop()
|
|
||||||
else:
|
|
||||||
while RUN_RELOADER:
|
|
||||||
try:
|
|
||||||
stat = os.stat(settings.SITE_CONFIG)
|
|
||||||
mtime = stat.st_mtime
|
|
||||||
if _win:
|
|
||||||
mtime -= stat.st_ctime
|
|
||||||
if mtime > _config_mtime:
|
|
||||||
load_config()
|
|
||||||
_config_mtime = mtime
|
|
||||||
time.sleep(10)
|
|
||||||
except:
|
|
||||||
#sys.stderr.write("reloading config failed\n")
|
|
||||||
pass
|
|
||||||
|
|
||||||
def update_static():
|
def update_static():
|
||||||
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
|
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
|
||||||
if os.path.exists(oxjs_build):
|
if os.path.exists(oxjs_build):
|
||||||
|
@ -406,18 +364,3 @@ def update_geoip(force=False):
|
||||||
else:
|
else:
|
||||||
print('failed to download GeoLite2-City.mmdb')
|
print('failed to download GeoLite2-City.mmdb')
|
||||||
|
|
||||||
def init():
|
|
||||||
if not settings.RELOADER_RUNNING:
|
|
||||||
load_config(True)
|
|
||||||
if settings.RELOAD_CONFIG:
|
|
||||||
thread.start_new_thread(reloader_thread, ())
|
|
||||||
|
|
||||||
def shutdown():
|
|
||||||
if settings.RELOADER_RUNNING:
|
|
||||||
RUN_RELOADER = False
|
|
||||||
settings.RELOADER_RUNNING = False
|
|
||||||
if NOTIFIER:
|
|
||||||
NOTIFIER.stop()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,7 @@ from django.core.validators import MaxLengthValidator
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
# load config from json
|
|
||||||
from . import config
|
from . import config
|
||||||
config.init()
|
|
||||||
|
|
||||||
NEW_LENGTH = {
|
NEW_LENGTH = {
|
||||||
'username': 255,
|
'username': 255,
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.core.management.base import BaseCommand
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
import clip.models
|
import clip.models
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
import clip.models
|
import clip.models
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
import clip.models
|
import clip.models
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.core.management.base import BaseCommand
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import connection, transaction
|
||||||
from django.db.models import fields
|
from django.db.models import fields
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
settings.RELOAD_CONFIG = False
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
from ... import models
|
from ... import models
|
||||||
import clip.models
|
import clip.models
|
||||||
|
|
|
@ -73,5 +73,3 @@ if __name__ == "__main__":
|
||||||
sys.stderr.write("Error: Can't find '%s'.\nBefore you run pan.do/ra you must create it\n" % settings.SITE_CONFIG)
|
sys.stderr.write("Error: Can't find '%s'.\nBefore you run pan.do/ra you must create it\n" % settings.SITE_CONFIG)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
import app.config
|
|
||||||
app.config.shutdown()
|
|
||||||
|
|
|
@ -220,7 +220,6 @@ XACCELREDIRECT = False
|
||||||
|
|
||||||
SITE_CONFIG = join(PROJECT_ROOT, 'config.jsonc')
|
SITE_CONFIG = join(PROJECT_ROOT, 'config.jsonc')
|
||||||
DEFAULT_CONFIG = join(PROJECT_ROOT, 'config.pandora.jsonc')
|
DEFAULT_CONFIG = join(PROJECT_ROOT, 'config.pandora.jsonc')
|
||||||
RELOAD_CONFIG = False
|
|
||||||
|
|
||||||
#used if CONFIG['canDownloadVideo'] is set
|
#used if CONFIG['canDownloadVideo'] is set
|
||||||
TRACKER_URL = "udp://tracker.openbittorrent.com:80"
|
TRACKER_URL = "udp://tracker.openbittorrent.com:80"
|
||||||
|
@ -275,7 +274,6 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
|
|
||||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024
|
||||||
|
|
||||||
RELOADER_RUNNING = False
|
|
||||||
#you can ignore things below this line
|
#you can ignore things below this line
|
||||||
#=========================================================================
|
#=========================================================================
|
||||||
LOCAL_APPS = []
|
LOCAL_APPS = []
|
||||||
|
|
Loading…
Reference in a new issue