import sys
import os
import site
import tempfile


os.environ['PYTHON_EGG_CACHE'] = tempfile.mkdtemp(prefix='moai-egg-cache-')

site.addsitedir(os.path.join(os.path.abspath(os.path.dirname(__file__)),
                             'lib',
                             'python%d.%d' % sys.version_info[:2],
                             'site-packages'))

from paste.deploy import loadapp
application = loadapp(
    'config:%s' % os.path.join(os.path.abspath(os.path.dirname(__file__)), 
                               'settings.ini'))

@@ -42,17 +42,36 @@
 empfile%0A
+import ConfigParser
 %0A
-
 %0Aos.envi
@@ -401,48 +401,162 @@
 app%0A
-application = loadapp(%0A    'config:%25s' %25
+%0Aif sys.version_info %3E= (2, 6):%0A    from logging.config import fileConfig%0Aelse:%0A    from paste.script.util.logging_config import fileConfig%0A%0Aconfig_file =
  os.
@@ -612,14 +612,9 @@
 _)),
- %0A    
+%0A
     
@@ -651,10 +651,165 @@
 gs.ini')
+%0Atry:%0A    fileConfig(config_file)%0Aexcept ConfigParser.NoSectionError:%0A    # no logging configured%0A    pass%0A%0Aapplication = loadapp('config:%25s' %25 config_file
 )%0A

add logging support