TemplateDoesNotExist but it exist
<p>Python 2.7 &amp; Django 1.10
my template exist but i do somesing wrong! </p>

<pre><code>TemplateDoesNotExist at /basicview/2/
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;TEST&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
This is template_two view!
&lt;/body&gt;
&lt;/html&gt;

Request Method:     GET
Request URL:    http://127.0.0.1:8000/basicview/2/
Django Version:     1.10.1
Exception Type:     TemplateDoesNotExist
Exception Value:    

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;TEST&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
This is template_two view!
&lt;/body&gt;
&lt;/html&gt;

Exception Location:     /home/i/djangoenv/local/lib/python2.7/site-packages/Django-1.10.1-py2.7.egg/django/template/loader.py in get_template, line 25
Python Executable:  /home/i/djangoenv/bin/python
Python Version:     2.7.11
Python Path:    

['/home/i/djangoenv/bin/firstapp',
 '/home/i/djangoenv/lib/python2.7',
 '/home/i/djangoenv/lib/python2.7/plat-i386-linux-gnu',
 '/home/i/djangoenv/lib/python2.7/lib-tk',
 '/home/i/djangoenv/lib/python2.7/lib-old',
 '/home/i/djangoenv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-i386-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/i/djangoenv/local/lib/python2.7/site-packages',
 '/home/i/djangoenv/local/lib/python2.7/site-packages/Django-1.10.1-py2.7.egg',
 '/home/i/djangoenv/lib/python2.7/site-packages',
 '/home/i/djangoenv/lib/python2.7/site-packages/Django-1.10.1-py2.7.egg']

Server time:    ÐÑ, 23 Ð¡ÐµÐ½ 2016 15:43:30 +0000
</code></pre>

<p><strong>settings.py</strong> (os.path.join(BASE_DIR), 'templates', or /home/mainapp/templates) not working..</p>

<pre><code>TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        '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>

<p><strong>article/views.py</strong> my def looks like:</p>

<pre><code>def template_two(request):
    view = "template_two"
    t = get_template('myview.html')
    html = t.render(Context({'name': view}))
    return render(request, html, {})
</code></pre>

<p>My file:</p>

<pre><code>mainapp/mainapp/settings.py
mainapp/mainapp/article/views.py
mainapp/templates/myview.html
</code></pre>

<p>I would suggest that you put your temlates in your app.</p>

<p>Your file will then be here: </p>

<pre><code>mainapp/mainapp/templates/myview.html
</code></pre>

<p>Please make sure you add <code>mainapp</code> to your <code>INSTALLED_APPS</code> like this:</p>

<pre><code>INSTALLED_APPS = [
   ...
   'mainapp',
]
</code></pre>

python django python-2.7 django-templates