ダミープロジェクトのディレクトリ構造
/dummy
/dummy
urls.py
views.py
setting.py
_init_
wsgi.py
/template
home.html
settings.py
TEMPLATE_DIRS = (
"D:/Data/Codes/Django_Code/dummy/template"
)
views.py
from django.shortcuts import render_to_response
from django.template import RequestContext
def home_view(request):
render_to_response(request, 'home.html')
urls.py
from django.conf.urls import patterns, include, url
from dummy.views import home_view
urlpatterns = patterns('',
url(r'^home/$', home_view),
)
TEMPLATE_DIRSの下のsetting.pyでテンプレートディレクトリを指定しましたが、TemplateDoesNotExistに頭を悩ませています
エラートレーステンプレート-ローダーの事後分析
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
D:\Data\Codes\Django_Code\dummy\template\<WSGIRequest
path:\home\,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'csrftoken': 'CNnHomGRMMJmik75Pi2rclMVdPjO36t9'},
META:{'ALLUSERSPROFILE': 'C:\ProgramData',
'APPDATA': 'C:\Users\nitin\AppData\Roaming',
'CLASSPATH': '.;D:\data\Codes;C:\Users\nitin\Downloads\javapostmark\apache-mime4j-0.6.jar;C:\Users\nitin\Downloads\javapostmark\commons-codec-1.3.jar;C:\Users\nitin\Downloads\javapostmark\commons-logging-1.1.1.jar;C:\Users\nitin\Downloads\javapostmark\gson-1.4.jar;C:\Users\nitin\Downloads\javapostmark\httpclient-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\httpcore-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\httpmime-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\joda-time-1.6.jar;',
'COMMONPROGRAMFILES': 'C:\Program Files\Common Files',
'COMMONPROGRAMFILES(X86)': 'C:\Program Files (x86)\Common Files',
'COMMONPROGRAMW6432': 'C:\Program Files\Common Files',
'COMPUTERNAME': 'NITIN-PC',
'COMSPEC': 'C:\Windows\system32\cmd.exe',
'CONTENT_LENGTH': '',
'CONTENT_TYPE': 'text\plain',
'CSRF_COOKIE': 'CNnHomGRMMJmik75Pi2rclMVdPjO36t9',
'DJANGO_SETTINGS_MODULE': 'dummy.settings',
'FP_NO_HOST_CHECK': 'NO',
'GATEWAY_INTERFACE': 'CGI\1.1',
'HOMEDRIVE': 'C:',
'HOMEPATH': '\Users\nitin',
'HTTP_ACCEPT': 'text\html,application\xhtml+xml,application\xml;q=0.9,*\*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
'HTTP_CACHE_CONTROL': 'max-age=0',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_COOKIE': 'csrftoken=CNnHomGRMMJmik75Pi2rclMVdPjO36t9',
'HTTP_HOST': '127.0.0.1:8000',
'HTTP_USER_AGENT': 'Mozilla\5.0 (Windows NT 6.1; WOW64) AppleWebKit\537.4 (KHTML, like Gecko) Chrome\22.0.1229.94 Safari\537.4',
'JAVA_HOME': 'C:\Program Files (x86)\Java\jdk1.7.0_05;',
'LOCALAPPDATA': 'C:\Users\nitin\AppData\Local',
'LOGONSERVER': '\NITIN-PC',
'NUMBER_OF_PROCESSORS': '2',
'OS': 'Windows_NT',
'PATH': 'C:\Program Files (x86)\Java\jdk1.7.0_05\bin;C:\Python27;C:\Python27\;C:\Python27\Scripts',
'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
'PATH_INFO': u'\home\',
'PROCESSOR_ARCHITECTURE': 'AMD64',
'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 23 Stepping 10, GenuineIntel',
'PROCESSOR_LEVEL': '6',
'PROCESSOR_REVISION': '170a',
'PROGRAMDATA': 'C:\ProgramData',
'PROGRAMFILES': 'C:\Program Files',
'PROGRAMFILES(X86)': 'C:\Program Files (x86)',
'PROGRAMW6432': 'C:\Program Files',
'PROMPT': '$P$G',
'PSMODULEPATH': 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\',
'PUBLIC': 'C:\Users\Public',
'QUERY_STRING': '',
'REMOTE_ADDR': '127.0.0.1',
'REMOTE_HOST': '',
'REQUEST_METHOD': 'GET',
'RUN_MAIN': 'true',
'SCRIPT_NAME': u'',
'SERVER_NAME': 'nitin-PC',
'SERVER_PORT': '8000',
'SERVER_PROTOCOL': 'HTTP\1.1',
'SERVER_SOFTWARE': 'WSGIServer\0.1 Python\2.7.3',
'SESSIONNAME': 'Console',
'SYSTEMDRIVE': 'C:',
'SYSTEMROOT': 'C:\Windows',
'TEMP': 'C:\Users\nitin\AppData\Local\Temp',
'TMP': 'C:\Users\nitin\AppData\Local\Temp',
'USERDOMAIN': 'nitin-PC',
'USERNAME': 'nitin',
'USERPROFILE': 'C:\Users\nitin',
'WINDIR': 'C:\Windows',
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x0000000001D761E0>,
'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x0000000002E5D5E8>,
'wsgi.input': <socket._fileobject object at 0x000000000327F138>,
'wsgi.multiprocess': False,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}> (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
C:\Python27\lib\site-packages\django\contrib\auth\templates\<WSGIRequest
path:\home\,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'csrftoken': 'CNnHomGRMMJmik75Pi2rclMVdPjO36t9'},
META:{'ALLUSERSPROFILE': 'C:\ProgramData',
'APPDATA': 'C:\Users\nitin\AppData\Roaming',
'CLASSPATH': '.;D:\data\Codes;C:\Users\nitin\Downloads\javapostmark\apache-mime4j-0.6.jar;C:\Users\nitin\Downloads\javapostmark\commons-codec-1.3.jar;C:\Users\nitin\Downloads\javapostmark\commons-logging-1.1.1.jar;C:\Users\nitin\Downloads\javapostmark\gson-1.4.jar;C:\Users\nitin\Downloads\javapostmark\httpclient-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\httpcore-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\httpmime-4.0.1.jar;C:\Users\nitin\Downloads\javapostmark\joda-time-1.6.jar;',
'COMMONPROGRAMFILES': 'C:\Program Files\Common Files',
'COMMONPROGRAMFILES(X86)': 'C:\Program Files (x86)\Common Files',
'COMMONPROGRAMW6432': 'C:\Program Files\Common Files',
'COMPUTERNAME': 'NITIN-PC',
'COMSPEC': 'C:\Windows\system32\cmd.exe',
'CONTENT_LENGTH': '',
'CONTENT_TYPE': 'text\plain',
'CSRF_COOKIE': 'CNnHomGRMMJmik75Pi2rclMVdPjO36t9',
'DJANGO_SETTINGS_MODULE': 'dummy.settings',
'FP_NO_HOST_CHECK': 'NO',
'GATEWAY_INTERFACE': 'CGI\1.1',
'HOMEDRIVE': 'C:',
'HOMEPATH': '\Users\nitin',
'HTTP_ACCEPT': 'text\html,application\xhtml+xml,application\xml;q=0.9,*\*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
'HTTP_CACHE_CONTROL': 'max-age=0',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_COOKIE': 'csrftoken=CNnHomGRMMJmik75Pi2rclMVdPjO36t9',
'HTTP_HOST': '127.0.0.1:8000',
'HTTP_USER_AGENT': 'Mozilla\5.0 (Windows NT 6.1; WOW64) AppleWebKit\537.4 (KHTML, like Gecko) Chrome\22.0.1229.94 Safari\537.4',
'JAVA_HOME': 'C:\Program Files (x86)\Java\jdk1.7.0_05;',
'LOCALAPPDATA': 'C:\Users\nitin\AppData\Local',
'LOGONSERVER': '\NITIN-PC',
'NUMBER_OF_PROCESSORS': '2',
'OS': 'Windows_NT',
'PATH': 'C:\Program Files (x86)\Java\jdk1.7.0_05\bin;C:\Python27;C:\Python27\;C:\Python27\Scripts',
'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
'PATH_INFO': u'\home\',
'PROCESSOR_ARCHITECTURE': 'AMD64',
'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 23 Stepping 10, GenuineIntel',
'PROCESSOR_LEVEL': '6',
'PROCESSOR_REVISION': '170a',
'PROGRAMDATA': 'C:\ProgramData',
'PROGRAMFILES': 'C:\Program Files',
'PROGRAMFILES(X86)': 'C:\Program Files (x86)',
'PROGRAMW6432': 'C:\Program Files',
'PROMPT': '$P$G',
'PSMODULEPATH': 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\',
'PUBLIC': 'C:\Users\Public',
'QUERY_STRING': '',
'REMOTE_ADDR': '127.0.0.1',
'REMOTE_HOST': '',
'REQUEST_METHOD': 'GET',
'RUN_MAIN': 'true',
'SCRIPT_NAME': u'',
'SERVER_NAME': 'nitin-PC',
'SERVER_PORT': '8000',
'SERVER_PROTOCOL': 'HTTP\1.1',
'SERVER_SOFTWARE': 'WSGIServer\0.1 Python\2.7.3',
'SESSIONNAME': 'Console',
'SYSTEMDRIVE': 'C:',
'SYSTEMROOT': 'C:\Windows',
'TEMP': 'C:\Users\nitin\AppData\Local\Temp',
'TMP': 'C:\Users\nitin\AppData\Local\Temp',
'USERDOMAIN': 'nitin-PC',
'USERNAME': 'nitin',
'USERPROFILE': 'C:\Users\nitin',
'WINDIR': 'C:\Windows',
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x0000000001D761E0>,
'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x0000000002E5D5E8>,
'wsgi.input': <socket._fileobject object at 0x000000000327F138>,
'wsgi.multiprocess': False,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}> (File does not exist)