2

我对 askbot-django-python 完全陌生。请帮我。

我使用 askbot.org 上的指南在 Ubuntu 15.10 服务器上安装 askbot 0.10.0。在安装过程中,运行服务器命令后,当我尝试从远程计算机访问该站点时,会显示主题错误消息。我花了一整天的时间来弄清楚但无法解决。请帮我

下面附上详细信息:

请求方法:GET
请求 URL: http: //212.222.47.4
:8000/questions/ Django 版本:1.7
异常类型:TemplateSyntaxError
异常值:无效块标签:'import'

异常位置:/usr/local/lib/python2.7/dist-packages/django/template/base.py in invalid_block_tag,第 344 行
Python 可执行文件:/usr/bin/python
Python 版本:2.7.10
Python 路径:'/ var/www/html/askbot/public_html',
'/usr/local/lib/python2.7/dist-packages/django_debug_toolbar-1.4-py2.7.egg',
'/usr/local/lib/python2.7/ dist-packages/python_openid-2.2.5-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/django_filter-0.5.4-py2.7.egg',
'/usr/ local/lib/python2.7/dist-packages/django_haystack-1.2.0-py2.7.egg',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64- linux-gnu',
' /usr/lib/python2.7/lib-tk','/usr/lib/python2.7/lib-old
',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/var/www/html/askbot',
'/usr/local/lib /python2.7/dist-packages/askbot/deps']

服务器时间:2016 年 1 月 2 日星期六 07:29:04 -0600

回溯附在下面:


回溯:
get_response 111 中的文件“/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py”。
response = Wrapped_callback(request, *callback_args, **callback_kwargs)
文件“/usr /local/lib/python2.7/dist-packages/askbot/views/readers.py”在问题
287. return render(request, 'main_page.html', template_data)
File "/usr/local/lib/python2.7 /dist-packages/django/shortcuts.py" 在渲染
48. return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/usr/local/lib/python2.7/dist-packages/django/template /loader.py" in render_to_string
170. t = get_template(template_name, dirs)
get_template 144 中的文件“/usr/local/lib/python2.7/dist-packages/django/template/loader.py”。template
, origin = find_template(template_name, dirs)
文件“/usr/local/lib/python2. 7/dist-packages/django/template/loader.py" in find_template
132. source, display_name = loader(name, dirs)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader .py" in call
44. return self.load_template(template_name, template_dirs)
文件 "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in load_template
50. template = get_template_from_string(source ,来源,模板名称)
文件“/usr/local/lib/python2.7/dist-packages/django/template/loader.py” 在 get_template_from_string
156. return Template(source, origin, name)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in init
132. self.nodelist = compile_string(template_string, origin)
compile_string
162 中的文件“/usr/local/lib/python2.7/dist-packages/django/template/base.py”。返回 parser.parse() 文件“/usr/local/lib/python2.7/dist-解析 290 中的 packages/django/template/base.py” 。compiled_result
= compile_func(self, token) do_extends 201
中的文件“/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py”
.nodelist = parser.parse()
解析中的文件“/usr/local/lib/python2.7/dist-packages/django/template/base.py”
288. self.invalid_block_tag(token, command, parse_until)
文件 "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in invalid_block_tag
344. raise self.error(token, "Invalid块标记:'%s'" % 命令)


异常类型:/questions/ 处的 TemplateSyntaxError
异常值:无效的块标签:'import'

4

2 回答 2

0

当您的 TEMPLATES settings.py 值为默认django-admin startproject值时会发生此错误,askbot 有一个特定的覆盖,您可以查看他们的 setup_templates

https://github.com/ASKBOT/askbot-devel/blob/master/askbot/setup_templates/settings.py#L76-L91

于 2017-09-15T22:29:32.480 回答
0

最后,进入第二天,将 django 升级到 1.8。问题得到了解决,但不确定根本原因是什么。

根据 askbot 文档,0.10.0 仅支持 django 1.7。但是升级到1.8,解决了这个问题。

于 2016-01-03T05:18:34.240 回答