title: Django 3.1 TemplateNotFound Exception when Template is Present
body: <p>I am trying to work towards deploying my application and have done most of my work on Windows. However now that I have moved it over to AWS it does not work anymore.</p>
  <p>Before anyone links other articles here is a list of all the things I have tried:</p>
  <ul>
  <li>Adding <code>os.path.join(BASE_DIR,'templates')</code> to <code>TEMPLATE_DIR</code></li>
  <li>Changing the permissions of my template</li>
  <li>My app is in my <code>INSTALLED_APPS</code> variable</li>
  <li>I have checked that all my <code>render</code> methods are formatted correctly</li>
  <li>Re-downloaded my project completely</li>
  </ul>
  <p>Like I said earlier, it works on my Windows machine, just not on AWS or my Mac. Even more strange is that the error says</p>
  <pre><code>Django tried loading these templates, in this order:
  
  Using engine django:
      * django.template.loaders.filesystem.Loader: /opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/python/lib/python3.8/site-packages/django/contrib/admin/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/python/lib/python3.8/site-packages/django/contrib/auth/templates/uploads/base.html  (Source does not exist)
  
  </code></pre>
  <p>And <code>/opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/base.html</code> is the correct absolute path to the template I am looking for. If I try to <code>cat</code> that file, using that absolute path, it prints to <code>stdout</code>. All this being said I will include some of my code for critical review.</p>
  <h3>views.py</h3>
  <pre class="lang-py prettyprint-override"><code>def get(self, request, *args, **kwargs):
          paste = None
          return render(request, 'uploads/index.html', {'paste': paste})
  
      def post(self, request, *args, **kwargs):
          paste = request.POST
          if is_post_valid(request):
              return upload(request)
          return render(request, 'uploads/index.html', {'paste': paste})
  </code></pre>
  <h3>INSTALLED_APPS</h3>
  <pre class="lang-py prettyprint-override"><code>INSTALLED_APPS = [
      'uploads.apps.UploadsConfig',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  ]
  </code></pre>
  <h3>TEMPLATES</h3>
  <pre class="lang-py prettyprint-override"><code>TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': ['/opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/'],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  </code></pre>
  <h3>Full Stack Trace</h3>
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://184.72.80.110:8000/
  
  Django Version: 3.1
  Python Version: 3.8.5
  Installed Applications:
  ['uploads.apps.UploadsConfig',
   'django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles']
  Installed Middleware:
  ['goFiles.middleware.upload.UploadCheckMiddleware',
   'django.middleware.security.SecurityMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  Template loader postmortem
  Django tried loading these templates, in this order:
  
  Using engine django:
      * django.template.loaders.filesystem.Loader: /opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/python/lib/python3.8/site-packages/django/contrib/admin/templates/uploads/base.html  (Source does not exist)
      * django.template.loaders.app_directories.Loader: /opt/bitnami/python/lib/python3.8/site-packages/django/contrib/auth/templates/uploads/base.html  (Source does not exist)
  
  
  Template error:
  In template /opt/bitnami/apps/django/django_projects/goFiles/uploads/templates/uploads/index.html, error at line 1
     uploads/base.html 
     1 :  {% extends &quot;uploads/base.html &quot;%} 
     2 : {% load static %}
     3 : {% block content %}
     4 :     &lt;div class=&quot;w3-container w3-border w3-border-color-gray&quot; id=&quot;paste_container&quot;&gt;
     5 :       &lt;!-- Source: https://codepen.io/jacoahmad/pen/vZXrOm --&gt;
     6 :       &lt;div class=&quot;o-constrained&quot; id=&quot;o-constrained&quot;&gt;
     7 :         {% if messages %}
     8 :         {% for message in messages %}
     9 :           &lt;div class=&quot;w3-panel w3-red w3-round&quot;&gt;
     10 :             &lt;p&gt;{{message}}&lt;p&gt;
     11 :           &lt;/div&gt;
  
  
  Traceback (most recent call last):
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/backends/django.py&quot;, line 61, in render
      return self.template.render(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/base.py&quot;, line 170, in render
      return self._render(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/base.py&quot;, line 162, in _render
      return self.nodelist.render(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/base.py&quot;, line 938, in render
      bit = node.render_annotated(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/base.py&quot;, line 905, in render_annotated
      return self.render(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/loader_tags.py&quot;, line 127, in render
      compiled_parent = self.get_parent(context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/loader_tags.py&quot;, line 124, in get_parent
      return self.find_template(parent, context)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/loader_tags.py&quot;, line 103, in find_template
      template, origin = context.template.engine.find_template(
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/engine.py&quot;, line 129, in find_template
      raise TemplateDoesNotExist(name, tried=tried)
  
  The above exception (uploads/base.html ) was the direct cause of the following exception:
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/core/handlers/exception.py&quot;, line 47, in inner
      response = get_response(request)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/core/handlers/base.py&quot;, line 179, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/views/generic/base.py&quot;, line 73, in view
      return self.dispatch(request, *args, **kwargs)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/views/generic/base.py&quot;, line 101, in dispatch
      return handler(request, *args, **kwargs)
    File &quot;/opt/bitnami/apps/django/django_projects/goFiles/uploads/views.py&quot;, line 18, in get
      return render(request, 'uploads/index.html', {'paste': paste})
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/shortcuts.py&quot;, line 19, in render
      content = loader.render_to_string(template_name, context, request, using=using)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/loader.py&quot;, line 62, in render_to_string
      return template.render(context, request)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/backends/django.py&quot;, line 63, in render
      reraise(exc, self.backend)
    File &quot;/opt/bitnami/python/lib/python3.8/site-packages/django/template/backends/django.py&quot;, line 84, in reraise
      raise new from exc
  
  Exception Type: TemplateDoesNotExist at /
  Exception Value: uploads/base.html 
  </code></pre>
  <p>If I need to include any more information I am happy to do so. Any help would be much appreciated.</p>