PyCharm 5找不到Django 1.9模板 [英] PyCharm 5 can't find Django 1.9 templates

查看:421
本文介绍了PyCharm 5找不到Django 1.9模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用PyCharm 5.0.3调试我的应用程序时,我想在模板文件(Django 1.9)中插入一些断点。

When I'm debugging my app with PyCharm 5.0.3, I want to insert a few breakpoints into template files (Django 1.9).

但是,当我在PyCharm调试模式下运行应用程序时,它会在处理第一个请求后立即打印以下警告。

However, when I run app in PyCharm debug mode, it prints the following warning as soon as it processes the first request.


警告:模板路径不可用。请在您的settings.py中设置TEMPLATE_DEBUG = True以使django模板断点工作。

WARNING: Template path is not available. Please set TEMPLATE_DEBUG=True in your settings.py to make django template breakpoints working

我已经阅读这里 TEMPLATE_DEBUG已被弃用,我已经以新格式设置了此设置。我也尝试将模板目录标记为Template Folder,而不是另一个Stackoverflow文章,但是没有帮助。

I've read here that TEMPLATE_DEBUG has been deprecated and I already have this setting in the new format. I've also tried marking the templates directory as "Template Folder" as per another Stackoverflow post, but it doesn't help.

有没有人看到这个问题?这是我的设置

Has anyone seen this issue before? Here are my settings

BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'debug': DEBUG,
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]


推荐答案

我收到了PyCharm的回复,这是一个已知的问题,将在下一个版本中修复。

I got a reply from PyCharm, it's a known issue and will be fixed in then next release.

https://youtrack.jetbrains.com/issue/PY-17923

这篇关于PyCharm 5找不到Django 1.9模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆