【问题标题】:django LBForum TemplateSyntaxErrordjango LBForum TemplateSyntaxError
【发布时间】:2014-01-17 19:30:30
【问题描述】:

我使用 virtualenv、django 1.3.1 和 LBForum (0.9.22) cms

我需要帮助如何纠正错误?

提前致谢

模板错误 在模板 /root/Dev/LBForum/ghlbforum/lbforum/templates/lbforum/inc_header.html 中,第 5 行出错

渲染时捕获 NoReverseMatch:“lbforum_index”的反向参数“()”和关键字参数“{}”未找到。 ![错误页面][1] ![错误页面][2]

【问题讨论】:

    标签: python django


    【解决方案1】:

    您是否在项目的主 URL 文件中包含了 LBForum 网址?

    https://github.com/vicalloy/LBForum#id7

    (r'^attachments/', include('attachments.urls')),
    (r'^', include('lbforum.urls')),
    

    当 urls.py 文件中没有匹配标签的 URL 模式时抛出 NoReverseMatch 错误

    【讨论】:

    • 在 django 中使用哪个版本?
    • 如果您正在运行 Django 测试服务器,请尝试转到无效的 url。也许 [链接](127.0.0.1:8000/a)。 404 页面将显示所有计算出的模式。如果名称为“lbforum_index”的模式不存在,则 url 未正确包含。
    【解决方案2】:
    yes, i use
    
    urls.py file
    
    from django.conf.urls.defaults import patterns, include, url
    
    from django.contrib import admin
    admin.autodiscover()
    
    urlpatterns = patterns('',
        (r'^attachments/', include('attachments.urls')),
        (r'^', include('lbforum.urls')),
        # Examples:
        # url(r'^$', 'ghlbforum.views.home', name='home'),
        # url(r'^ghlbforum/', include('ghlbforum.foo.urls')),
    
        # Uncomment the admin/doc line below to enable admin documentation:
        # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    
        # Uncomment the next line to enable the admin:
        url(r'^admin/', include(admin.site.urls)),
    )
    

    【讨论】:

    • 您应该编辑问题。不要让它成为答案。
    猜你喜欢
    • 2012-05-26
    • 2020-06-16
    • 2011-05-07
    • 2011-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-25
    • 2011-11-13
    相关资源
    最近更新 更多