Turned off Django DEBUG in the default setup. This resolves all issues with memory leakage and resource hogging seen in issue112.

This commit is contained in:
Griatch 2010-10-11 17:22:39 +00:00
parent 12acb34ce7
commit 151595a042
4 changed files with 18 additions and 15 deletions

View file

@ -10,6 +10,7 @@ from src.server import sessionhandler
from src.players.models import PlayerDB from src.players.models import PlayerDB
from src.scripts.models import ScriptDB from src.scripts.models import ScriptDB
from src.objects.models import ObjectDB from src.objects.models import ObjectDB
from src.config.models import ConfigValue
from src.permissions.models import PermissionGroup from src.permissions.models import PermissionGroup
from src.utils import reloads, create, logger, utils from src.utils import reloads, create, logger, utils
from src.permissions.permissions import has_perm, has_perm_string from src.permissions.permissions import has_perm, has_perm_string
@ -92,11 +93,13 @@ class CmdPy(MuxCommand):
'testscript') 'testscript')
obj = create.create_object("src.objects.objects.Object", obj = create.create_object("src.objects.objects.Object",
'testobject') 'testobject')
conf = ConfigValue() # used to access conf values
available_vars = {'self':caller, available_vars = {'self':caller,
'me':caller, 'me':caller,
'here':caller.location, 'here':caller.location,
'obj':obj, 'obj':obj,
'script':script} 'script':script,
'config':conf}
caller.msg(">>> %s" % pycode) caller.msg(">>> %s" % pycode)
try: try:
ret = eval(pycode, {}, available_vars) ret = eval(pycode, {}, available_vars)

View file

@ -88,7 +88,7 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False):
try: try:
try: try:
print "importing %s: CACHED_CMDSETS=%s" % (python_path, CACHED_CMDSETS) #print "importing %s: CACHED_CMDSETS=%s" % (python_path, CACHED_CMDSETS)
wanted_cache_key = python_path wanted_cache_key = python_path
cmdsetclass = CACHED_CMDSETS.get(wanted_cache_key, None) cmdsetclass = CACHED_CMDSETS.get(wanted_cache_key, None)
errstring = "" errstring = ""
@ -99,7 +99,7 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False):
module = __import__(modulepath, fromlist=[True]) module = __import__(modulepath, fromlist=[True])
cmdsetclass = module.__dict__[classname] cmdsetclass = module.__dict__[classname]
CACHED_CMDSETS[wanted_cache_key] = cmdsetclass CACHED_CMDSETS[wanted_cache_key] = cmdsetclass
print "cmdset %s found." % wanted_cache_key #print "cmdset %s found." % wanted_cache_key
#instantiate the cmdset (and catch its errors) #instantiate the cmdset (and catch its errors)
if callable(cmdsetclass): if callable(cmdsetclass):
cmdsetclass = cmdsetclass(cmdsetobj) cmdsetclass = cmdsetclass(cmdsetobj)
@ -165,6 +165,8 @@ class CmdSetHandler(object):
self.mergetype_stack = ["Union"] self.mergetype_stack = ["Union"]
self.update() self.update()
#print "cmdsethandler init. id:%s, obj:%s, cmdsetstack:%s " % (id(self), self.obj.key, [cmdset.key for cmdset in self.cmdset_stack])
def __str__(self): def __str__(self):
"Display current commands" "Display current commands"

View file

@ -26,8 +26,6 @@ def create_config_values():
ConfigValue.objects.conf("default_home", "2") ConfigValue.objects.conf("default_home", "2")
ConfigValue.objects.conf("site_name", settings.SERVERNAME) ConfigValue.objects.conf("site_name", settings.SERVERNAME)
ConfigValue.objects.conf("idle_timeout", settings.IDLE_TIMEOUT) ConfigValue.objects.conf("idle_timeout", settings.IDLE_TIMEOUT)
#ConfigValue.objects.conf("money_name_singular", "Credit")
#ConfigValue.objects.conf("money_name_plural", "Credits")
def create_connect_screens(): def create_connect_screens():
""" """

View file

@ -65,16 +65,15 @@ LANGUAGE_CODE = 'en-us'
# since it creates a lot of help entries that has nothing to do # since it creates a lot of help entries that has nothing to do
# with what is actually available in the game. # with what is actually available in the game.
IMPORT_MUX_HELP = False IMPORT_MUX_HELP = False
# How long time (seconds) a user may idle before being logged # How long time (in seconds) a user may idle before being logged
# out. This can be set as big as desired. A user may avoid being # out. This can be set as big as desired. A user may avoid being
# thrown off by sending the empty system command 'idle' to the server # thrown off by sending the empty system command 'idle' to the server
# at regular intervals. # at regular intervals. Set <=0 to deactivate idle timout completely.
IDLE_TIMEOUT = 3600 IDLE_TIMEOUT = 3600
# The set of encodings tried. A Player object may set an attribute "encoding" on # If the PlayerAttribute 'encoding' is not set, or wrong encoding is
# itself to match the client used. If not set, or wrong encoding is # given, this list is tried, in order, stopping on the first match.
# given, this list is tried, in order, aborting on the first match. # Add sets for languages/regions your players are likely to use. (see
# Add sets for languages/regions your players are likely to use. # http://en.wikipedia.org/wiki/Character_encoding).
# (see http://en.wikipedia.org/wiki/Character_encoding)
ENCODINGS = ["utf-8", "latin-1", "ISO-8859-1"] ENCODINGS = ["utf-8", "latin-1", "ISO-8859-1"]
################################################### ###################################################
@ -314,9 +313,10 @@ IRC_NICKNAME = ""
# While DEBUG is False, show a regular server error page on the web # While DEBUG is False, show a regular server error page on the web
# stuff, email the traceback to the people in the ADMINS tuple # stuff, email the traceback to the people in the ADMINS tuple
# below. By default (True), show a detailed traceback for the web # below. If True, show a detailed traceback for the web
# browser to display. # browser to display. Note however that this might leak memory when
DEBUG = True # active, so make sure turn it off for a production server!
DEBUG = False
# While true, show "pretty" error messages for template syntax errors. # While true, show "pretty" error messages for template syntax errors.
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
# Emails are sent to these people if the above DEBUG value is False. If you'd # Emails are sent to these people if the above DEBUG value is False. If you'd