Answer the question
In order to leave comments, you need to log in
Django where is the error?
Good time of the day!
I'm learning Django, tell me where the error is:
Error:
TemplateDoesNotExist at /basicviwe/2/
mywiew.html
Request Method: GET
Request URL: 127.0.0.1:8000/basicviwe/2
Django Version: 1.8
Exception Type: TemplateDoesNotExist
Exception Value:
mywiew.html
Exception Location: /home/mk/Documents/ DjangoTest2/myvenv/lib/python3.5/site-packages/django/template/loader.py in get_template, line 46
Python Executable: /home/mk/Documents/DjangoTest2/myvenv/bin/python
Python Version: 3.5.1
Python Path:
['/home/mk/Documents/DjangoTest2',
'/usr/lib/python35.zip',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64- linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/home/mk/Documents/DjangoTest2/myvenv/lib/python3.5/site-packages']
DIRNAME = os.path.abspath(os.path.dirname(__file__))
TEMPLATE_DIRS = (
os.path.join(DIRNAME, r'/home/mk/Documents/DjangoTest2/templates'),
)
'/home/mk/Documents/DjangoTest2/templates',
os.path.join(BASE_DIR, 'templates'),
def template_two(request):
view = "template_two"
t = get_template('myview.html')
html = t.render(Context({'name': view}))
return HttpResponse(html)
def basic_one(request):
view = 'basic_one'
html = 'This is %s view' % view
return HttpResponse(html)
Answer the question
In order to leave comments, you need to log in
At least it should
DIRNAME = os.path.dirname(os.path.abspath(__file__))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question