Commit 3dc59fda authored by Migs Atienza's avatar Migs Atienza

Created base.html + Started on home.html

parent 367e8a1c
{% extends 'base.html' %}
{% block title %}My Favorite Books & Authors{% endblock %}
{% block heading %}Welcome to Migs' Database of Favorite Books & Authors!{% endblock %}
{% block content %}The books listed here consist of story-driven, action adventure titles with
interesting characters. While I haven't been reading recently, the database is made up of books I enjoyed
a while back. An author I enjoy here would be Rick Riordan and his Percy Jackson series as I was
immersed with the fantasy world he made which utilized Greek myths and stories.{% endblock %}
<div>
<a href="/books">Books</a>
<a href="/authors">Authors</a>
</div>
from django.urls import path from django.urls import path
from .views import index from .views import index, home_view
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
path('home', home_view, name='home_view')
] ]
app_name = "<bookshelf>" app_name = "<bookshelf>"
......
...@@ -3,5 +3,8 @@ from django.shortcuts import render ...@@ -3,5 +3,8 @@ from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
def index(request): def index(request):
return HttpResponse('Hello World! This came from the index view') return request('Hello World! This came from the index view')
def home_view(request):
return render(request, 'home.html')
# Create your views here. # Create your views here.
...@@ -58,7 +58,7 @@ ROOT_URLCONF = 'migs_atienza_reading.urls' ...@@ -58,7 +58,7 @@ ROOT_URLCONF = 'migs_atienza_reading.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
<h1>{% block heading %}{% endblock %}</h1>
</head>
<body>
<div id="content">
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
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