更新:请参阅自我回答。当我做出更改时,我无法重启apache。
当我尝试在生产服务器中运行我的django应用程序时,我在查找模板方面遇到以下错误。我认为这与存储模板的位置有关;我已经更改了设置文件中的目录,但我想我可能错过了另一个地方。
我正在试图找到我所指的“C:/ django / booking / reserve”,因为这是给出的路径,但我似乎无法弄清楚在哪里。有什么建议吗?
Exception Type: TemplateDoesNotExist
Exception Value: reserve/templates/index.html
Exception Location: /home/sharataka/webapps/django/lib/python2.7/django/template/loader.py in find_template, line 138
Python Path: ['/home/sharataka/webapps/django',
'/home/sharataka/webapps/django/booking',
'/home/sharataka/webapps/django/reserve',
'/home/sharataka/webapps/django/lib/python2.7',
'/home/sharataka/lib/python2.7/South-0.7.5-py2.7.egg',
'/home/sharataka/lib/python2.7/pip-1.1-py2.7.egg',
'/home/sharataka/lib/python2.7/django_debug_toolbar-0.9.4-py2.7.egg',
'/home/sharataka/lib/python2.7',
'/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/site-packages/PIL']
Django tried loading these templates, in this order:
• Using loader django.template.loaders.filesystem.Loader:
o /home/sharataka/C:/django/booking/reserve/templates/index.html (File does not exist
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
STATIC_ROOT = '/webapps/django/'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/webapps/django",
)
答案 0 :(得分:1)
当我做出更改时,我无法重启apache ...我是django菜鸟:)