Commit 8392e27c authored by justin's avatar justin

Initialized homepage and base URL routing

parent a04ee101
{% extends 'base.html' %} {% block content %}
<h1>Welcome to Justin's Database of Favorite Books and Authors!</h1>
<p>
I love all types of books, and most of the ones I read are just
recommendations made to me by different people, especially my girlfriend. I
love reading horror, biographies, and more. Thanks!
</p>
<ul>
<li><a href="/books">Books</a></li>
<li><a href="/authors">Authors</a></li>
</ul>
{% endblock %}
from django.urls import path
from .views import index
urlpatterns = [
path("", index, name="home"),
]
from django.shortcuts import render
from django.views import View
# Create your views here.
def index(request):
return render(
request,
"bookshelf/home.html",
)
# class HomePageView(View):
# def get(self, request):
# return (render, "bookshelf/home.html")
......@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -55,7 +56,7 @@ ROOT_URLCONF = "justinreyes_reading.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [os.path.join(BASE_DIR), "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
......
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path("admin/", admin.site.urls),
path("home/", include("bookshelf.urls")),
]
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<title>
{% block title %} My Favorite Books and Authors {% endblock %}
</title>
{% block styles %}{% endblock %}
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
{% block scripts %}{% endblock %}
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment