0
我的任務是顯示html頁面中的文件夾數據。但它的顯示空白頁請任何人幫我在哪裏我做錯了。文件數據不顯示在html頁面
view.py
def info(request,id):
INFO_DIR = '/home/des-0064/Logs'
req_path = os.path.join(INFO_DIR, id)
file_content = dict()
for root, dirs, files in os.walk(req_path):
for file_name in files:
full_path = os.path.join(root,file_name)
with open(full_path, 'r') as _file:
#file_content[file_name] = _file.read()
file_content[file_name] = _file.read()
print file_content
for file_name, content in file_content.iteritems():
print file_name
print content
return HttpResponse (request, 'info.html')
難以置信的類型:'dict'(它給出的錯誤) – annonymus
@annonymus - 更新,你需要先對它進行jsonify – Sayse