无法在我的django应用程序中使用百日草

时间:2012-09-04 01:39:36

标签: python django zinnia

访问test server/weblog/上的localhost网址时,在“最新一切稳定”的环境中(python 2.7,django 1.4.1,apache 2.2.22)我得到了:

NoReverseMatch at /weblog/

Reverse for 'zinnia_entry_add' with arguments '()' and keyword arguments '{}' not found.

Request Method:     GET
Request URL:    http://127.0.0.1/weblog/
Django Version:     1.4.1
Exception Type:     NoReverseMatch
Exception Value:    

Reverse for 'zinnia_entry_add' with arguments '()' and keyword arguments '{}' not found.

Exception Location:     /usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in render, line 424
Python Executable:  /usr/bin/python
Python Version:     2.7.3

摘录自settings.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.staticfiles',
    'django.contrib.admindocs',
    'django.contrib.messages',
    'django.contrib.comments',
    'image_labeler',
    'tagging',
    'mptt',
    'zinnia',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.i18n',
    'django.core.context_processors.request',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'zinnia.context_processors.version',
    )

urls.py

urlpatterns = patterns('',
    # Example:
    # (r'^lastpixel/', include('lastpixel.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^weblog/', include('zinnia.urls')),
    (r'^comments/', include('django.contrib.comments.urls')),
    (r'^admin/', include(admin.site.urls)),
    (r'^$', views.Index),
    (r'^login/?$', views.Login),
    (r'^logout/?$', views.Logout),
    (r'^register/?$', views.Register),
    (r'^i$', include('image_labeler.urls')),
    (r'^i/', include('image_labeler.urls')),
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/lastpixel/web/media', 'show_indexes': True}),
    (r'^.*$', views.Index),
)

该应用程序另有工作(没有百日草博客)。知道我可能做错了什么吗?非常感谢!

2 个答案:

答案 0 :(得分:2)

更新百日草后我遇到了类似的问题。 这帮助了我,虽然我没想到在mysql中有一个解决方案:

首先,修改/etc/my.conf

[client]
default-character-set=utf8

[mysqld]
default-character-set = utf8
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8

其次,重启mysql

取自: zinnia on github

答案 1 :(得分:2)

可能是名称空间问题。在您的错误页面中,您是否看到内联错误突出显示类似{% block 'zinnia:zinnia_entry_add' %}的内容?这是zinnia名称空间的一部分,由该定义的zinnia:部分指示。如果您看到类似的内容,则可能只需要在URL中添加正确的命名空间:

urlpatterns = patterns('',
    #.....
    (r'^weblog/', include('zinnia.urls', namespace="zinnia")),
    #.....
)