def django_init(self):

        elems = os.path.split(self.root)[:-1]
        parent = os.path.join(*elems)
        sys.path.append(parent)

        BASE_APP = []
        try:
            # Attempt to import the root folder. This is necessary to access
            # the local templatetag libraries.
            base = os.path.split(self.root)[-1]
            logger.debug("importing app: %s" % base)
            importlib.import_module(base)
            BASE_APP = [ base ]
        except ImportError as exc:
            logger.debug("app '{}' cannot be imported: {}".format(base, exc))

        TEMPLATE_DIR = join(os.path.dirname(__file__), "templates")
        dirs = [self.root, join(self.root, 'templates'), TEMPLATE_DIR]
        logger.debug("template dirs: {}".format(dirs))
        settings.configure(
            DEBUG=True, TEMPLATE_DEBUG=True,
            TEMPLATES=[
                {
                    'BACKEND': 'django.template.backends.django.DjangoTemplates',
                    'DIRS': dirs,
                    'APP_DIRS': True,
                    'OPTIONS': {
                        'string_if_invalid': "Undefined: %s ",
                        'builtins': [
                            'pyblue.templatetags.pytags',
                            'django.contrib.humanize.templatetags.humanize',
                        ],
                    }
                }
            ],
            INSTALLED_APPS=["pyblue", "django.contrib.humanize",
                            "django.contrib.staticfiles"] + BASE_APP,

            STATIC_URL='/static/',
        )
        django.setup()

        logger.debug("templatetags: %s" % ", ".join(get_installed_libraries()))
Initializes the django engine. The root must have been set already."
dataset/ETHPy150Open ialbert/pyblue/pyblue/engine.py/PyBlue.django_init