如何在浏览器中显示linux日志文件中的行 [英] How can display the lines from linux log file in browser

查看:66
本文介绍了如何在浏览器中显示linux日志文件中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 linux 日志文件中获取行,并使用django在Bowser中显示.

I am getting the lines from the linux log files and i am displaying in the bowser using django.

  1. 它们都显示为相同的paragarah,但我想用换行符显示它们
  2. 如果我在< pre>中扭曲它们,它们将在nelwines中显示.行</pre> ,但是我的html标签未正确呈现
  1. They are all displaying as same paragarah but i want to show them with new lines
  2. They display in nelwines if i warp them in <pre> lines </pre> but then my html tags are not rendered properly

有没有办法以正确的格式显示该内容,并正确显示换行符和html标记

is there any way to display that in good format with newlines and html tag rendered properly

推荐答案

您可以使用内置模板标签:

You can use built-in template tags:

{{ lines|linebreaks }}

{{ lines|linebreaksbr }}

这篇关于如何在浏览器中显示linux日志文件中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆