diff --git a/mysite/settings.py b/mysite/settings.py index 3b2a5ac..af49365 100644 --- a/mysite/settings.py +++ b/mysite/settings.py @@ -59,7 +59,7 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [BASE_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ diff --git a/templates/accounts/signup.html b/templates/accounts/signup.html new file mode 100644 index 0000000..43f7dcb --- /dev/null +++ b/templates/accounts/signup.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} ← base.htmlを継承 + +{% block title %}Sign Up{% endblock %} ← titleを入れる + +{% block content %} +
+ {{ form.as_p }} ← formにはSignupFormのインスタンスが入っている。as_pとすることで、各input要素がpタグで囲まれた状態で表示される。 + {% csrf_token %} ← csrf_token必須。formタグ内であればどこに書いてもOK + +
+{% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index d5a9c14..f17b52f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,9 +2,25 @@ - Document + {% block title %}Twitter Clone{% endblock %} + +
+ +
+ + +
+ {% block content %} + {% endblock %} +
+ - + \ No newline at end of file diff --git a/welcome/urls.py b/welcome/urls.py index a1c99ad..ac4f4cd 100644 --- a/welcome/urls.py +++ b/welcome/urls.py @@ -4,5 +4,5 @@ app_name = "welcome" urlpatterns = [ - path("", views.WelcomeView.as_view()), + path("", views.WelcomeView.as_view(), name="welcome"), ]