我已经尝试了我能想到的一切但却无法解决这个问题。这是我现在的wsgi.py文件。
#!/usr/bin/python
import os
virtenv = os.path.join(os.environ.get('OPENSHIFT_PYTHON_DIR', '.'), '/virtenv/')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
#
# IMPORTANT: Put any additional includes below this line. If placed above this
# line, it's possible required libraries won't be in your searchable path
#
import logging, sys
# logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
from minimal import app as application
application.config.from_object('minimal.config.Production')
log_file_name = os.path.join(
os.environ.get('OPENSHIFT_PYTHON_LOG_DIR', '.'),
'app.log')
handler = logging.FileHandler(log_file_name)
handler.setLevel(logging.DEBUG)
application.logger.addHandler(handler)
application.logger.setLevel(logging.DEBUG)
我已经尝试过这种想法的各种排列,无法实现任何目标。将流设置为sys.stderr并不起作用。在我的代码中的任何位置设置它似乎不起作用。在我的代码中的某一点将日志记录处理程序设置为任何类型的处理程序似乎也没有帮助。我在python.log文件中记录的所有内容都是:
[Tue Jul 14 12:54:12 2015] [notice] caught SIGWINCH, shutting down gracefully
- - - [14/Jul/2015:12:54:12 -0400] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.2.15 (Red Hat) (internal dummy connection)"
[Tue Jul 14 12:57:30 2015] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c3,c75
[Tue Jul 14 12:57:31 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 14 12:57:31 2015] [notice] Digest: done
[Tue Jul 14 12:57:31 2015] [notice] Apache/2.2.15 (Unix) mod_wsgi/3.4 Python/2.7.8 configured -- resuming normal operations
这只是在部署期间。什么,甚至错误或异常都被记录下来。当我第一次开始我的项目时,更多的东西被记录下来了,但在某个地方,它们都消失了。 ' app.log'您可以看到我尝试在wsgi.py中创建的文件永远不会创建。
' minimal.config'中的配置文件很简单:
class Config(object):
DEBUG = False
ASSETS_DEBUG = False
TESTING = False
class Development(Config):
DEBUG = True
ASSETS_DEBUG = True
class Production(Config):
PROPAGATE_EXCEPTIONS = True
class Testing(Config):
TESTING = True
我现在可以转向尝试解决这个问题吗?