尝试访问我正在尝试构建的个人网站时,我不断收到以下错误消息:
TypeError: render_page() takes exactly 2 arguments (1 given)
我什至不知道如何,因为我使用的是 render_to_response() 而不是直接调用 render_page() ,所以我认为这种事情会得到处理?
视图.py:
from django.http import HttpResponse,Http404
from django.template import Template,Context
from django.template.loader import get_template
from django.shortcuts import *
navs = {"About Me":"/aboutme/","Teaching":"/teaching/","CV":"/cv/","Online":"/epresence/",
"Links":"/links/","Main":"/main/"}
def render_page(request,page):
if page == "epresence":
return epresence(request)
elif page == "links":
return links(request)
elif page == "teaching":
return teaching(request)
else:
return other(request,page)
def epresence(request):
pagetitle = "My Online Presence"
sites = {...}
navitems = globals().get("navs")
return render_to_response("epresence.html",locals())
def links(request):
pagetitle = "Links"
navitems = globals().get("navs")
friends = {...
}
idols = {...
}
resources = {...}
return render_to_response("links.html",locals())
def teaching(request):
pagetitle = "Teaching"
navitems = globals().get("navs")
teach = [...]
learn = [...]
return render_to_response("teaching.html",locals())
def other(request,page):
pages = {"about":"About Me","me":"About Me","cv":"CV","home":"Home","main":"Home",}
patetitle = pages.get(page)
navitems = globals().get("navs")
return render_to_response("main.html",locals())
网址.py:
from django.conf.urls import patterns, include, url
from personalsite.views import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^.*$',render_page),
)
有什么建议么?