import django.template.loader
import django.conf
import sys

sys.path.append('django_test')
django.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))

for x in range(0,100):
    django.template.loader.render_to_string('template.html')

import django.template.loader
import django.conf
import sys, os

os.chdir(os.path.dirname(__file__))

django.conf.settings.configure(
    INSTALLED_APPS=(), 
    TEMPLATES=[{
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": ['.']
    }],
)
django.setup()

for x in range(0,100):
    django.template.loader.render_to_string('template.html')

Update template render example for Django 1.8+
Update template render example for Django 1.8+

  import django.template.loader
  import django.conf
- import sys
+ import sys, os
  
- sys.path.append('django_test')
- django.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))
+ os.chdir(os.path.dirname(__file__))
+ 
+ django.conf.settings.configure(
+     INSTALLED_APPS=(), 
+     TEMPLATES=[{
+         "BACKEND": "django.template.backends.django.DjangoTemplates",
+         "DIRS": ['.']
+     }],
+ )
+ django.setup()
  
  for x in range(0,100):
      django.template.loader.render_to_string('template.html')
  
Update template render example for Django 1.8+
## Code Before:
import django.template.loader
import django.conf
import sys

sys.path.append('django_test')
django.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))

for x in range(0,100):
    django.template.loader.render_to_string('template.html')

## Instruction:
Update template render example for Django 1.8+
## Code After:
import django.template.loader
import django.conf
import sys, os

os.chdir(os.path.dirname(__file__))

django.conf.settings.configure(
    INSTALLED_APPS=(), 
    TEMPLATES=[{
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": ['.']
    }],
)
django.setup()

for x in range(0,100):
    django.template.loader.render_to_string('template.html')
