[英]Can't get zinnia to work in my django application
Upon accessing the test server/weblog/
url on localhost
, in an environment with "latest everything stable" (python 2.7, django 1.4.1, apache 2.2.22) I'm getting: 在“一切稳定”环境(python 2.7,django 1.4.1,apache 2.2.22)中访问localhost
上的test server/weblog/
url后,我得到:
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
Excerpt from settings.py
: 摘自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',
)
and from urls.py
: 并从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),
)
The application works otherwise (withouth the zinnia blog). 该应用程序可以正常工作(没有百日草博客)。 Any idea what I might be doing wrong? 知道我做错了什么吗? Much appreciated! 非常感激!
I had a similar problem after updating zinnia. 更新百日草后,我遇到了类似的问题。 This helped me out, although I didn't expect a solution in mysql: 这帮助了我,尽管我没想到在mysql中有解决方案:
First, edit /etc/my.conf
首先,编辑/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
Second, restart mysql 二,重启mysql
Taken from: zinnia on github 摘自: 百日草在github上
It is likely that it is a namespace problem. 这很可能是名称空间问题。 In your error page, do you see the inline error highlight something that looks like {% block 'zinnia:zinnia_entry_add' %}
? 在错误页面中,您是否看到内联错误突出显示了类似{% block 'zinnia:zinnia_entry_add' %}
? This is part of the zinnia
name space, indicated by the zinnia:
part of that definition. 这是zinnia
命名空间的一部分,由zinnia
表明zinnia:
该定义的一部分。 If you see something like this, you likely just need to add the correct namespace to your URLs: 如果看到类似这样的内容,则可能只需要在URL中添加正确的名称空间即可:
urlpatterns = patterns('',
#.....
(r'^weblog/', include('zinnia.urls', namespace="zinnia")),
#.....
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.