diff --git a/chapter2/mysite/myapp/templates/myapp/crawl.html b/chapter2/mysite/myapp/templates/myapp/crawl.html
index afeeaa8..07d28c0 100644
--- a/chapter2/mysite/myapp/templates/myapp/crawl.html
+++ b/chapter2/mysite/myapp/templates/myapp/crawl.html
@@ -119,8 +119,8 @@
内存占用
-
{{platform_info.mem_total}}
-
{{platform_info.mem_used}}
+
{{platform_info.mem_total|to_g}}
+
{{platform_info.mem_used|to_g}}
diff --git a/chapter2/mysite/myapp/templatetags/myapp.py b/chapter2/mysite/myapp/templatetags/myapp.py
index eed2b7c..6e961a3 100644
--- a/chapter2/mysite/myapp/templatetags/myapp.py
+++ b/chapter2/mysite/myapp/templatetags/myapp.py
@@ -6,4 +6,10 @@ register = template.Library()
@register.simple_tag
def present(val1, val2):
"""获取两个数的百分比,取整 val1 / val2 """
- return int(int(val1) * 100 / int(val2))
\ No newline at end of file
+ return int(int(val1) * 100 / int(val2))
+
+
+@register.filter
+def to_g(val):
+ """字节到G"""
+ return int(int(val)/1024/1024)
\ No newline at end of file