I'm newer for Django, just finish the Django tutorial last week. I install zinnia today in my virtualenv, and I'm sure that I have installed all the dependencies such as PIL, tag, mptt etc. pip install django ( version is 1.4.2) pip install zinnia Then, here are the details of my steps:
- django-admin.py startproject yuetu
- Modify the setting.py in yuetu/yuetu directory like:
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',
) # Optional
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
#'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'django.contrib.comments',
'tagging',
'mptt',
'zinnia',
)
3.Modify the urls.py like:
url(r'^weblog/', include('zinnia.urls')), url(r'^comments/', include('django.contrib.comments.urls')),4.run python manage.py validate No errors. 5.run python manage.py syncdb No errors. All the tables are in my Mysql database; 6.run python manage.py runserver No errors
but When I browse the page with 127.0.0.1:8000/weblog I got a exception like:
NoReverseMatch at /weblog/
u'admin' is not a registered namespace
Request Method: GET
Request URL: http://127.0.0.1:8000/weblog/
Django Version: 1.4.2
Exception Type: NoReverseMatch
Exception Value:
u'admin' is not a registered namespace
Exception Location: /root/Envs/yuetu_zinnia/lib/python2.7/site-packages/django/template/defaulttags.py in render, line 424
Python Executable: /root/Envs/yuetu_zinnia/bin/python
Python Version: 2.7.3
Python Path:
['/root/Envs/yuetu_zinnia/yuetu',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg',
'/usr/local/pythonbrew/lib',
'/root/Envs/yuetu_zinnia/lib/python27.zip',
'/root/Envs/yuetu_zinnia/lib/python2.7',
'/root/Envs/yuetu_zinnia/lib/python2.7/plat-linux2',
'/root/Envs/yuetu_zinnia/lib/python2.7/lib-tk',
'/root/Envs/yuetu_zinnia/lib/python2.7/lib-old',
'/root/Envs/yuetu_zinnia/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages',
'/root/Envs/yuetu_zinnia/lib/python2.7/site-packages/PIL']
Error during template rendering
In template /root/Envs/yuetu_zinnia/lib/python2.7/site-packages/zinnia/templates/zinnia/entry_list.html, error at line 50
u'admin' is not a registered namespace
40 {% endif %}
41 {% endblock %}
42
43 {% block content-loop %}
44 {% for object in object_list %}
45 {% with object_content=object.html_content|truncatewords_html:100|safe continue_reading=1 %}
46 {% include "zinnia/_entry_detail.html" %}
47 {% endwith %}
48 {% empty %}
49 <p class="notice">
50 <a href="{% url 'admin:zinnia_entry_add' %}">{% trans "No entries yet." %}</a>
51 </p>
52 {% endfor %}
53 {% endblock %}
54
55 {% block content-pagination %}
56 {% if is_paginated %}
57 {% zinnia_pagination page_obj %}
58 {% endif %}
59 {% endblock %}
60
Anyone tell me what's my wrong?
Make sure that your project urls.py has the admin system enabled:
# urls.py
from django.conf.urls import patterns, include, url
# MAKE SURE THESE TWO LINES ARE UNCOMMENTED!
from django.contrib import admin
admin.autodiscover()
urlpatters = patterns('',
# MAKE SURE THIS NEXT LINE IS UNCOMMENTED!
url(r'^admin/', include(admin.site.urls)),
url(r'^weblog/', include('zinnia.urls')),
url(r'^comments/', include('django.contrib.comments.urls')),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With