这是我的代码
from datetime import datetime
from django.conf import settings
class Utils(object):
def get_logs(self):
try:
with open(settings.LOGFILE, 'r') as fd:
data_logs = fd.readlines()
return data_logs
except IOError:
return []
def write_log(self, content):
date = datetime.now()
with open(settings.LOGFILE, 'a+') as fd:
fd.write("%s : %s\n" % (date.strftime("%b %d %Y %H:%M:%S"), content))
当我运行服务器时,Django给出错误Django: Settings' object has no attribute 'LOGFILE'
。是什么原因造成的?