[問題] 單獨用 django 的 template
請問django的template
要如何單獨拿來用
我剛剛試了一個exsample
from django import template
t = template.Template('My name is {{ name }}.')
c = template.Context({'name': 'Adrian'})
print(t.render(c))
出現一些錯誤訊息
django.core.exceptions.ImproperlyConfigured: Requested setting
TEMPLATE_DEBUG, but settings are not configured. You must either define the
environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
before accessing settings.
大概就是要設環境之類的
但我整個程式又不想有多的設定檔或py檔
如果很麻煩我就安裝其他單純是模板的lib好了
謝謝
--
-好管弦事-
A place about cello and music....
http://fnt72.blogspot.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.124.1.1
※ 文章網址: http://www.ptt.cc/bbs/Python/M.1419484835.A.B82.html
→
12/25 14:08, , 1F
12/25 14:08, 1F
→
12/25 14:08, , 2F
12/25 14:08, 2F
→
12/25 14:54, , 3F
12/25 14:54, 3F
→
12/25 14:55, , 4F
12/25 14:55, 4F
推
12/25 15:00, , 5F
12/25 15:00, 5F
→
12/25 15:00, , 6F
12/25 15:00, 6F
→
12/25 19:02, , 7F
12/25 19:02, 7F
→
12/25 19:02, , 8F
12/25 19:02, 8F
→
12/26 15:09, , 9F
12/26 15:09, 9F
→
12/26 15:09, , 10F
12/26 15:09, 10F
→
12/26 15:10, , 11F
12/26 15:10, 11F
→
12/26 17:51, , 12F
12/26 17:51, 12F
→
12/26 17:52, , 13F
12/26 17:52, 13F
→
12/26 23:32, , 14F
12/26 23:32, 14F
推
12/29 21:20, , 15F
12/29 21:20, 15F
Python 近期熱門文章
PTT數位生活區 即時熱門文章