ドキュメントによると、アプリのルートディレクトリに「templates」という名前のフォルダーがある場合、djangoはアプリからテンプレートを自動的にロードする必要があります。
アプリを追加しました
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
# 'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
# Use email as username https://github.com/dabapps/django-email-as-username
'emailusernames',
'purchaseapp' # this is my app
)
テンプレートフォルダを作成しました
管理者をログインページとして使用するようにurlpatternsを設定しました
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'timely.views.home', name='home'),
# url(r'^timely/', include('timely.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^$', hello),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}),
url(r'^accounts/$', 'django.views.generic.simple.redirect_to', {'url': '/'}),
url(r'^accounts/profile/$', 'django.views.generic.simple.redirect_to', {'url': '/'}),
)
base_site.htmlを上書きしましたが、カスタマイズが表示されません。これにより、フォルダーがTEMPLATE_DIRSに追加されるかどうかがわかります。
TEMPLATE_DIRS = (
"/Users/nicola/Documents/Aptana Studio 3 Workspace/timely/purchaseapp/templates",
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
私は何が間違っているのですか?