def _import_django(self):
        from smarturls import surl  # issue #19. manual imports
        self.surl = surl

        from django.http import HttpResponse, Http404, HttpResponseRedirect
        self.HttpResponse = HttpResponse
        self.Http404, self.HttpResponseRedirect = Http404, HttpResponseRedirect

        from django.shortcuts import (get_object_or_404, get_list_or_404,
                                      render_to_response, render, redirect)
        self.get_object_or_404 = get_object_or_404
        self.get_list_or_404 = get_list_or_404
        self.render_to_response = render_to_response
        self.render, self.redirect = render, redirect

        from django.template import RequestContext
        self.RequestContext = RequestContext

        from django import forms
        self.forms = forms

        try:
            from django.core.wsgi import get_wsgi_application
            self.wsgi_application = get_wsgi_application()
        except ImportError:
            import django.core.handlers.wsgi
            self.wsgi_application = django.core.handlers.wsgi.WSGIHandler()

        try:
            # https://devcenter.heroku.com/articles/django-assets
            from whitenoise.django import DjangoWhiteNoise
            self.wsgi_application = DjangoWhiteNoise(self.wsgi_application)
        except ImportError:
            pass

        try:
            from django.conf.urls.defaults import patterns, url
        except ImportError:
            from django.conf.urls import patterns, url  # lint:ok
        self.patterns, self.url = patterns, url
Do the Django imports.
dataset/ETHPy150Open amitu/importd/importd/__init__.py/D._import_django