昨天我正在使用本教程开发我的第一个应用程序.这是一个民意调查和选择应用程序.第一页显示问题,当您点击问题时,它会显示您可以对其进行投票的选项.
昨天我有很棒的人帮我,并告诉我使用命名空间.我已经阅读了命名空间教程,并尝试将我的知识应用到场景中,但到目前为止它还没有工作.
当我点击第一页的问题时,这是我的错误.
NoReverseMatch at /polls/5/
u"'polls" is not a registered namespace
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/5/
Django Version: 1.4.3
Exception Type: NoReverseMatch
Exception Value:
u"'polls" is not a registered namespace
Exception Location: C:\hp\bin\Python\Lib\site-packages\django\template\defaulttags.py in render, line 424
Python Executable: C:\hp\bin\Python\python.exe
Python Version: 2.5.2
Python Path:
['C:\\djcode\\mysite',
'C:\\hp\\bin\\Python\\python25.zip',
'C:\\hp\\bin\\Python\\DLLs',
'C:\\hp\\bin\\Python\\lib',
'C:\\hp\\bin\\Python\\lib\\plat-win',
'C:\\hp\\bin\\Python\\lib\\lib-tk',
'C:\\hp\\bin\\Python',
'C:\\hp\\bin\\Python\\lib\\site-packages',
'C:\\hp\\bin\\Python\\lib\\site-packages\\win32',
'C:\\hp\\bin\\Python\\lib\\site-packages\\win32\\lib',
'C:\\hp\\bin\\Python\\lib\\site-packages\\Pythonwin']
Server time: Fri, 15 Feb 2013 21:04:10 +1100
Error during template rendering
In template C:\djcode\mysite\myapp\templates\myapp\detail.html, error at line 5
u"'polls" is not …Run Code Online (Sandbox Code Playgroud) 我一直在http://lightbird.net/dbe/photo.html上处理这个照片管理器和共享应用程序第一部分.我正在尝试生成缩略图,当我这样做时.我收到这个错误.
我有Windows Vista.
IOError at /admin/photo/image/add/
(13, 'Permission denied')
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/photo/image/add/
Django Version: 1.4.3
Exception Type: IOError
Exception Value: (13, 'Permission denied')
Exception Location:C:\Python26\lib\site-packages\PIL\Image.py in save, line 1399
Python Executable:C:\Python26\python.exe
Python Version: 2.6.0
Python Path:
['C:\\djcode\\mysite',
'C:\\Python26\\python26.zip',
'C:\\Python26\\DLLs',
'C:\\Python26\\lib',
'C:\\Python26\\lib\\plat-win',
'C:\\Python26\\lib\\lib-tk',
'C:\\Python26',
'C:\\Python26\\lib\\site-packages',
'C:\\Python26\\lib\\site-packages\\PIL']
Server time: Sun, 10 Feb 2013 23:49:34 +1100
Run Code Online (Sandbox Code Playgroud)
我的models.py是
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from string import join
from django.core.files import …Run Code Online (Sandbox Code Playgroud) 我正在使用教程创建这个django应用程序,我要完成第4部分https://docs.djangoproject.com/en/dev/intro/tutorial04/
该应用程序显示基本轮询,当您单击它时,它会显示一些选项和一个投票按钮.
问题是当我点击投票.它显示找不到页面.我认为问题是重定向,但我不知道在哪里确定问题.第一页是index.html,它显示问题,然后是detail.html,显示选项和问题.我知道当我点击投票时,它会回到应用程序URLconf,然后urlconf执行视图功能,视图功能执行结果.
我的detail.html是
<h1>{{ poll.question }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="/myapp/{{ poll.id }}/vote/" method="post">
{% csrf_token %}
{% for choice in poll.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" />
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br />
{% endfor %}
<input type="submit" value="Vote" />
</form>
Run Code Online (Sandbox Code Playgroud)
myapp里面的urls.py是:
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls import patterns, include, url
urlpatterns = patterns('myapp.views',
url(r'^$', …Run Code Online (Sandbox Code Playgroud)