lzjun567 / django_blog

a blog powered by django
http://foofish.net
207 stars 96 forks source link

本地搭建进入首页报错了,知道什么原因吗?谢谢 #1

Closed slowfishc closed 10 years ago

slowfishc commented 10 years ago

Environment:

Request Method: GET Request URL: http://localhost:8000/

Django Version: 1.6.2 Python Version: 2.6.6 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.sites', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sitemaps', 'reversion', 'apps.blog', 'pagedown', 'south', 'apps.bootstrap_pagination', 'compressor', 'debug_toolbar') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Template error: In template D:\zeero.zhang\app\python\web\django_blog\apps\blog\templates\index.html, error at line 2 'myapp_markup' is not a valid tag library: ImportError raised loading apps.blog.templatetags.myapp_markup: No module named markdown2 1 : {% extends "base.html" %}

2 : {% load myapp_markup %}

3 : {% load bootstrap_pagination %}

4 :

5 : {% block description %}FooFish的自话自说,Bloger,Enginner{%endblock%}

6 : {% block title %}FooFish的自话自说{% endblock %}

7 :

8 : {% block content %}

9 : {% for blog in blogs %}

10 :

11 :

12 : {{blog.title}}

Traceback: File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response

  1. response = wrapped_callback(request, _callback_args, *_callback_kwargs) File "D:\zeero.zhang\app\python\web\django_blog\apps\blog\views.py" in index
  2. return render(request, 'index.html', {'blogs':blogs}) File "C:\Python26\lib\site-packages\django\shortcutsinit.py" in render
  3. return HttpResponse(loader.render_to_string(_args, *_kwargs), File "C:\Python26\lib\site-packages\django\template\loader.py" in render_to_string
  4. t = get_template(template_name) File "C:\Python26\lib\site-packages\django\template\loader.py" in get_template
  5. template, origin = find_template(template_name) File "C:\Python26\lib\site-packages\django\template\loader.py" in find_template
  6. source, display_name = loader(name, dirs) File "C:\Python26\lib\site-packages\django\template\loader.py" in call
  7. return self.load_template(template_name, template_dirs) File "C:\Python26\lib\site-packages\django\template\loader.py" in load_template
  8. template = get_template_from_string(source, origin, template_name) File "C:\Python26\lib\site-packages\django\template\loader.py" in get_template_from_string
  9. return Template(source, origin, name) File "C:\Python26\lib\site-packages\django\template\base.py" in init
  10. self.nodelist = compile_string(template_string, origin) File "C:\Python26\lib\site-packages\django\template\base.py" in compile_string
  11. return parser.parse() File "C:\Python26\lib\site-packages\django\template\base.py" in parse
  12. compiled_result = compile_func(self, token) File "C:\Python26\lib\site-packages\django\template\loader_tags.py" in do_extends
  13. nodelist = parser.parse() File "C:\Python26\lib\site-packages\django\template\base.py" in parse
  14. compiled_result = compile_func(self, token) File "C:\Python26\lib\site-packages\django\template\defaulttags.py" in load
  15. (taglib, e))

Exception Type: TemplateSyntaxError at / Exception Value: 'myapp_markup' is not a valid tag library: ImportError raised loading apps.blog.templatetags.myapp_markup: No module named markdown2

lzjun567 commented 10 years ago

你好,project中有代码依赖了markdown2,不过这个markdown2实际代码中没有用到。因此报错了。你有两个选择:

  1. 重新clone一份代码 或者
  2. pip install markdown2

具体的报错在代码出现在文件: django_blog/apps/blog/templatetags.py下面

#! coding=utf-8
#import markdown2
import markdown

from django import template
from django.template.defaultfilters import stringfilter
from django.utils.encoding import force_unicode
from django. utils.safestring import mark_safe

register = template.Library()

#@register.filter(is_safe=True)
#@stringfilter
#def md2(value):
#    '''
#        目前markdown2 无法处理井号(####)标题
#    '''
#    return mark_safe(markdown2.markdown(
#                force_unicode(value),
#                safe_mode=True)
#            )
#    return mark_safe(markdown2.markdown(value))
slowfishc commented 10 years ago

感谢,重新安装了markdown2之后好了,多谢多谢。

这个项目后续还有没有继续增强的计划?

在 2014-03-29 23:10:04,lzjun567 notifications@github.com 写道:

你好,project中有代码依赖了markdown2,不过这个markdown2实际代码中没有用到。因此报错了。你有两个选择:

  1. 重新clone一份代码 或者
  2. pip install markdown2

— Reply to this email directly or view it on GitHub.

lzjun567 commented 10 years ago

有很多,但都不是紧急的。比如:

  1. 当用户登录了后可以在当前显示界面快速修改文章。
  2. 上传图片到服务器
  3. 优化后端文章编辑功能,现在的预览效果不好,希望支持全屏编辑+预览
slowfishc commented 10 years ago

好,我先把现有的熟悉下

在 2014-03-30 16:10:00,lzjun567 notifications@github.com 写道:

有很多,但都不是紧急的。比如:

  1. 当用户登录了后可以在当前显示界面快速修改文章。
  2. 上传图片到服务器
  3. 优化后端文章编辑功能,现在的预览效果不好,希望支持全屏编辑+预览

— Reply to this email directly or view it on GitHub.