python运行显示无此模板_运行django应用程序时模板不显示

我的django应用程序的结构如下所示home/damon/dev/me/myproject/

manage.py

/mytracker/

__init__.py

settings.py

urls.py

/monitor/

/media/

/mymonitor/

__init__.py

models.py

views.py

urls.py

/templates/

base.html

home.html

在.bashrc中,我将PYTHONPATH设置为/home/damon/dev/me/myproject/

在设置.py为媒体根目录和模板目录添加了这些值

^{pr2}$

在mytracker.url.py有url(r'',include('mymonitor.urls')),

url(r'^site_media/(?P.*)$','django.views.static.serve',{'document_root':settings.MEDIA_ROOT}),

鉴于mymonitor.url.py有...

url(r'^$','mymonitor.views.home',

{'template_name':'home.html',

'page_title':'Home'

},

name='home'),

..

在基本.html扩展了主页.html在{% extends "base.html" %}

{% block content %}

Your Home

{% endblock %}

我认为pythonpath,文件的位置,一切都是正确的…但是我仍然得到一个templatedoesnotex错误Request Method: GET

Request URL: http://127.0.0.1:8000/

Django Version: 1.4

Exception Type: TemplateDoesNotExist

Exception Value:

[{'page_title': 'Home'}, {'csrf_token':

在视图.py有def custom_render(request,context,template):

req = RequestContext(request,context)

return render_to_response(req)

def home(request,template_name,page_title):

context = {'page_title':page_title}

return custom_render(request,context,template_name)

我不明白为什么会这样发生了。怎么做我要诊断这个错误吗。。?有人能告诉我吗?在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值