Don't fire atexit when developing

This commit is contained in:
Ruud
2012-01-28 12:32:27 +01:00
parent a848a18d37
commit 4bf430a32e
2 changed files with 10 additions and 8 deletions
+10
View File
@@ -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