|
|
@ -5,11 +5,13 @@ from couchpotato.core.event import fireEventAsync, fireEvent |
|
|
|
from couchpotato.core.helpers.variable import getDataDir, tryInt |
|
|
|
from logging import handlers |
|
|
|
from werkzeug.contrib.cache import FileSystemCache |
|
|
|
import atexit |
|
|
|
import locale |
|
|
|
import logging |
|
|
|
import os.path |
|
|
|
import sys |
|
|
|
import traceback |
|
|
|
import time |
|
|
|
|
|
|
|
def getOptions(base_path, args): |
|
|
|
|
|
|
@ -39,6 +41,11 @@ def getOptions(base_path, args): |
|
|
|
return options |
|
|
|
|
|
|
|
|
|
|
|
def cleanup(): |
|
|
|
fireEvent('app.crappy_shutdown', single = True) |
|
|
|
time.sleep(1) |
|
|
|
|
|
|
|
|
|
|
|
def runCouchPotato(options, base_path, args, desktop = None): |
|
|
|
|
|
|
|
# Load settings |
|
|
@ -88,6 +95,9 @@ def runCouchPotato(options, base_path, args, desktop = None): |
|
|
|
debug = options.debug or Env.setting('debug', default = False, type = 'bool') |
|
|
|
Env.set('debug', debug) |
|
|
|
|
|
|
|
if not Env.setting('development'): |
|
|
|
atexit.register(cleanup) |
|
|
|
|
|
|
|
# Disable server access log |
|
|
|
server_log = logging.getLogger('werkzeug') |
|
|
|
server_log.disabled = True |
|
|
|