问个django的有关问题…
问个django的问题……
我按着这个教程一直做下去的,
http://www.youtube.com/watch?v=0QwDJ1N2SJM&feature=BFa&list=PL385A53B00B8B158
结果运行时就出错了……
TemplateSyntaxError at /
Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with
arguments '()' and keyword arguments '{}' not found.
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.2.7
Exception Type: TemplateSyntaxError
Exception Value:
Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with
arguments '()' and keyword arguments '{}' not found.
Exception Location: D:\Python27\lib\site-packages\django\template
\defaulttags.py in render, line 385
Python Executable: D:\Python27\python.exe
Python Version: 2.7.2
Python Path: ['E:\\PY\\django\\blog', 'C:\\Windows\\system32\
\python27.zip', 'D:\\Python27\\DLLs', 'D:\\Python27\\lib', 'D:\
\Python27\\lib\\plat-win', 'D:\\Python27\\lib\\lib-tk', 'D:\\Python27',
'D:\\Python27\\lib\\site-packages', 'D:\\Python27\\lib\\site-packages\
\PIL', 'D:\\Python27\\lib\\site-packages\\win32', 'D:\\Python27\\lib\
\site-packages\\win32\\lib', 'D:\\Python27\\lib\\site-packages\
\Pythonwin', 'D:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']
Server time: Mon, 20 Aug 2012 23:08:59 +0800
google了一晚都没结果。就看到google论坛上有一个貌似和我看同一个教程的也出
现这种错误……不过没有解决办法……
我的配置
URL:
urlpatterns = patterns('blog.apps.homepage.views',
url(r'^about/$', 'about', name="homepage_about"),
)
模板里:
<a href="{% url homepage_about %}">about</a>
views.py
def about(request):
return render_to_response('homepage/about.html')
project
http://pan.baidu.com/share/link?shareid=4823&uk=402707982
谁能告诉我怎么改才可以正常运行?
谢谢!
------解决方案--------------------
Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found
你好像没有传参数过去啊?打点log看看。
------解决方案--------------------
模板里改成这样
我按着这个教程一直做下去的,
http://www.youtube.com/watch?v=0QwDJ1N2SJM&feature=BFa&list=PL385A53B00B8B158
结果运行时就出错了……
TemplateSyntaxError at /
Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with
arguments '()' and keyword arguments '{}' not found.
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.2.7
Exception Type: TemplateSyntaxError
Exception Value:
Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with
arguments '()' and keyword arguments '{}' not found.
Exception Location: D:\Python27\lib\site-packages\django\template
\defaulttags.py in render, line 385
Python Executable: D:\Python27\python.exe
Python Version: 2.7.2
Python Path: ['E:\\PY\\django\\blog', 'C:\\Windows\\system32\
\python27.zip', 'D:\\Python27\\DLLs', 'D:\\Python27\\lib', 'D:\
\Python27\\lib\\plat-win', 'D:\\Python27\\lib\\lib-tk', 'D:\\Python27',
'D:\\Python27\\lib\\site-packages', 'D:\\Python27\\lib\\site-packages\
\PIL', 'D:\\Python27\\lib\\site-packages\\win32', 'D:\\Python27\\lib\
\site-packages\\win32\\lib', 'D:\\Python27\\lib\\site-packages\
\Pythonwin', 'D:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']
Server time: Mon, 20 Aug 2012 23:08:59 +0800
google了一晚都没结果。就看到google论坛上有一个貌似和我看同一个教程的也出
现这种错误……不过没有解决办法……
我的配置
URL:
urlpatterns = patterns('blog.apps.homepage.views',
url(r'^about/$', 'about', name="homepage_about"),
)
模板里:
<a href="{% url homepage_about %}">about</a>
views.py
def about(request):
return render_to_response('homepage/about.html')
project
http://pan.baidu.com/share/link?shareid=4823&uk=402707982
谁能告诉我怎么改才可以正常运行?
谢谢!
------解决方案--------------------
Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found
你好像没有传参数过去啊?打点log看看。
------解决方案--------------------
模板里改成这样
- Python code
<a href="{% url 'homepage_about' %}">about</a>
------解决方案--------------------
观看<a href="{% url 'homepage_about' %}">about</a>