【发布时间】:2011-11-22 16:21:26
【问题描述】:
每次我尝试访问管理页面时都会收到此错误 这就是追溯
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.3.1
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/ajmi/spam/templates/admin/login.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/login.html (File exists)
/usr/local/lib/python2.7/dist- packages/django/contrib/admindocs/templates/admin/login.html (File does not exist)
Using loader django.template.loaders.eggs.Loader:
login.html 文件不存在,如何解决。 谢谢
【问题讨论】:
-
我注意到回溯表明文件 确实 存在于 app_directories 加载器中。它可能不可读或类似的东西吗?这绝对是一个奇怪的问题。
-
是的,正如@LukeSneeringer 指出的那样,请查看您的文件系统权限。这意味着,看看你是否真的可以打开和阅读 /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/login.html 与你运行你的用户权限相同测试服务器。
-
谢谢大家,我通过输入:sudo python manage.py runserver 更改了root用户的权限。而且效果很好
-
如果您的某些问题仍未解决,请在此处查看我的答案。 stackoverflow.com/a/32358905/303681
标签: django