The code above will render "Hello, John!" as a string with the variable substitution context set to {'name': 'John'}
from django.shortcuts import render_to_string
# Render a string with variable substitution
context = {'name': 'John'}
rendered_string = render_to_string('Hello, {{ name }}!', context)
print(rendered_string) # Output: 'Hello, John!'