を設定されていない私はジャンゴを使用していると私は動的に与えられたテンプレート(lab.html)からHTMLファイルを生成する必要があります。しかし、私はこの奇妙なエラーを取得しておくDjangoのエラー:DjangoTemplatesのバックエンドが
from django.template import Template, Context
from django.conf import settings
settings.configure()
f = qc.QFile('lab.html')
f.open(qc.QFile.ReadOnly | qc.QFile.Text)
stream = qc.QTextStream(f)
template = stream.readAll()
print(template)
f.close()
t = Template(template)
c = Context({"result": "test"}) #result is the variable in the html file that I am trying to replace
を私はいくつかの研究の後でどこにも見つけられていない。何かご意見は?
Traceback (most recent call last):
File "/Users/gustavorangel/PycharmProjects/help/HelpUI.py", line 262, in filesSearch
t = Template(template)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py", line 184, in __init__
engine = Engine.get_default()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/engine.py", line 83, in get_default
"No DjangoTemplates backend is configured.")
django.core.exceptions.ImproperlyConfigured: No DjangoTemplates backend is configured.
回答ありがとうございます。私のsettings.pyは投稿したものとまったく同じです! :/ –
ちょっと@GustavoRangel、私はあなたがPythonシェルではなく、動作するはずのビューからこれをやっていたので、私のコメントを更新しました。この解決策を試してみてください! –