很长一段时间以来,我一直在努力让它发挥作用,但我现在真的束手无策。我已经尝试做我在 SO 和烧瓶文档中可以找到的所有事情,但我仍然无法使用简单的错误日志来调试我的应用程序。以下是粘贴的代码 -
# main.py
from flask import Flask
import logging
app = Flask(__name__)
file_handler = logging.FileHandler(filename='/tmp/election_error.log')
file_handler.setLevel(logging.WARNING)
app.logger.addHandler(file_handler)
@app.route('/')
def hello():
return "hello
#missing quotes to generate error
if __name__ == "__main__":
app.run()
#wsgi file
import sys
import logging
sys.path.insert(0, "/var/www/voting_app")
logging.basicConfig(stream=sys.stderr)
from main import app as application
# apache2 conf file
WSGIDaemonProcess voting_app threads=5
WSGIScriptAlias /election /var/www/voting_app/voting_app.wsgi
LogLevel info
<Directory /var/www/voting_app>
WSGIProcessGroup voting_app
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
请告诉我哪里出错了。太感谢了。