I am new to Django. I am using pydev eclipse as an IDE. First I created a project, then the application welcomed this project. I created a folder called "Templates" in the project and created the file "home.html", and home.html contains
<div> This is my first site </div>
I am changing the settings.py file as
TEMPLATE_DIRS = ("Templates") INSTALLED_APPS = ( ..........#all default items 'welcome', #the added one )
views.py includes
from django.shortcuts import render_to_response def home(request): return render_to_response('home.html')
urls.py contains
from django.conf.urls import patterns, include, url from welcome.views import home from django.contrib import admin admin.autodiscover() urlpatterns = patterns('',
then I run it as a django project and open my browser and see on localhost: 8000 / home it shows an error
TemplateDoesNotExist at /home/ home.html Request Method: GET Request URL: http://localhost:8000/home/ Django Version: 1.6 Exception Type: TemplateDoesNotExist Exception Value: home.html Exception Location: C:\Python27\django\template\loader.py in find_template, line 131 Python Executable: C:\Python27\python.exe Python Version: 2.7.2 Python Path: ['D:\\Bishnu\\BE\\4th year\\8th semester\\Major Project II\\Working\\Workspace\\MajorProject', 'C:\\Python27\\lib\\site-packages\\distribute-0.6.35-py2.7.egg', 'D:\\Bishnu\\BE\\4th year\\8th semester\\Major Project II\\Working\\Workspace\\MajorProject', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Windows\\SYSTEM32\\python27.zip'] Server time: Sun, 2 Jun 2013 14:25:52 +0545
Bishnu bhattarai
source share