Render Django template from command line, without settings
问题 Is there a way to render a Django template from command line without invoking any settings? I want to do this outside any Django apps or project, to be able to use it as a command line tool to render a template with some variables. Is there a tool that does this already? Jinja2 would be fine too. 回答1: You can use settings.configure() if you don't have any custom settings to configure. from django.conf import settings settings.configure() from django.template import Template, Context Template(