settings:
import os.path
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),
)
urls.py:
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from cy.views import index
urlpatterns = patterns('',
(r'^$',index), (这里地方怎么弄?)
)
views.py:
from django.http import Http404,HttpResponse
from django.template.loader import get_template
from django.template import Context
import datetime
def index(request):
now=datetime.datetime.now()
return render_to_response('index.html', locals())
以下是我的目录结构
cy:
manage.py cy:
__init__.py settings.py urls.py views.py wsgi.py templates:
base.html
index.html
about.html
contact.html