django模板错误13

时间:2017-05-22 16:47:17

标签: python django

我的django模板有问题。我在pycharm和代码中创建了新的模板文件,我觉得一切都很好。但我拒绝了13号权限。其他模板工作正常。

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/Doggo/2/results/

Django Version: 1.11
Python Version: 3.6.1
Installed Applications:
['Doggo.apps.DoggoConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "C:\Python36-32\lib\site-packages\django\core\handlers\exception.py" in inner
  41.             response = get_response(request)

File "C:\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  217.                 response = self.process_exception_by_middleware(e, request)

File "C:\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  215.                 response = response.render()

File "C:\Python36-32\lib\site-packages\django\template\response.py" in render
  107.             self.content = self.rendered_content

File "C:\Python36-32\lib\site-packages\django\template\response.py" in rendered_content
  82.         template = self.resolve_template(self.template_name)

File "C:\Python36-32\lib\site-packages\django\template\response.py" in resolve_template
  64.             return select_template(template, using=self.using)

File "C:\Python36-32\lib\site-packages\django\template\loader.py" in select_template
  48.                 return engine.get_template(template_name)

File "C:\Python36-32\lib\site-packages\django\template\backends\django.py" in get_template
  39.             return Template(self.engine.get_template(template_name), self)

File "C:\Python36-32\lib\site-packages\django\template\engine.py" in get_template
  162.         template, origin = self.find_template(template_name)

File "C:\Python36-32\lib\site-packages\django\template\engine.py" in find_template
  136.                         name, template_dirs=dirs, skip=skip,

File "C:\Python36-32\lib\site-packages\django\template\loaders\base.py" in get_template
  38.                 contents = self.get_contents(origin)

File "C:\Python36-32\lib\site-packages\django\template\loaders\filesystem.py" in get_contents
  28.             with io.open(origin.name, encoding=self.engine.file_charset) as fp:

Exception Type: PermissionError at /Doggo/2/results/
Exception Value: [Errno 13] Permission denied: 'C:\\Users\\noob1_000\\PycharmProjects\\eWybory\\Doggo\\templates'

我认为我有权访问此文件夹,因为其他模板正在运行。 我正在使用Windows 10

2 个答案:

答案 0 :(得分:0)

我建议您浏览this -

此外,您使用模板的视图也与其他视图位于同一目录中,因为您说其他视图可以访问其模板吗?

请告诉我,如果这可以解决您的问题

答案 1 :(得分:-1)

也许您只是忘记在template path中标出template / app/index.htmlviews.py)。