ユーザー登録とログイン用のアプリを開発しています。登録フォームを作成しましたが、ログインページを作成したいと考えています。そのため、login.html ファイルを作成しました。テンプレート。したがって、ディレクトリを作成し、そのディレクトリhome/html/templates/registration/login.htmlに配置します
settings.pyファイルの Template_dir=()は次のとおりです。
TEMPLATE_DIRS = (
'/home/html/templates',
)
ビューファイルは
from django.template import loader
from registration.models import Registration
from django.http import HttpResponse
def login(request):
t = loader.get_template('registration/login.html')
return HttpResponse()
しかし、このファイルをlocalhost:8000/registration/login.htmlとして実行しようとすると、404 エラー Page not found が表示されます
url.pyファイルで指定された URL は次のとおりです。
url(r'^registration/$', 'registration.views.login'),