Hi guys,
I'm starting to learn how use Python as part of my class project. I
decided to use the Django framework w/ Eclipse and I've completely
stuck on an seemingly common error. Here are some snippets of the
code:
views.py
----------------------------------------
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
import datetime
def current_datetime(request):
now = datetime.datetime.now()
t = get_template('current_datetime.html')
html = t.render(Context({'current_date': now}))
return HttpResponse(html)
urls
---------------------------------------
urlpatterns = patterns('',
('^date/$', current_datetime)
)
settings.py
-----------------------------------------
TEMPLATE_DIRS = [
'G:/'
]
ERROR
------------------------------------------
Request Method: GET
Request URL: http://127.0.0.1:8000/date/
Django Version: 1.2.5
Exception Type: TemplateDoesNotExist
Exception Value: current_date.html
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
G:/current_date.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
c:\python27\lib\site-packages\django\contrib\sitemaps\templates
\current_date.html (File does not exist)
c:\python27\lib\site-packages\django\contrib\admin\templates
\current_date.html (File does not exist)
I even put my current_date html in the other 2 folders above. I'm
definitely 100% clear that I have current_date.html in my G:/
directory. Before I had created a template folder within the project
directory (using the full directory path) and tried to reference it
there but failed also. Thanks.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.