Commit 146a6cd4 authored by Jayson Lim's avatar Jayson Lim

created the templates along with the base template with placeholder content

parent 93252b9b
{% extends 'base.html' %}
{% load static %}
{% block title %}This is the page title{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}This is the page title{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}This is the page title{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}This is the page title{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}This is the page title{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import index from .views import home_view, BooksPageView
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
urlpatterns = [ urlpatterns = [
path('', index, name='index'), #path('', index, name='index'),
path('home', home_view, name='home'),
path('books', BooksPageView.as_view(), name='books'),
] ]
app_name = "bookshelf" app_name = "bookshelf"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import View
def index(request): def home_view(request):
return HttpResponse('Hello World!') return render(request, 'home.html')
class BooksPageView(View):
def get(request):
return render(request, 'bookshelf/books.html')
...@@ -58,7 +58,7 @@ ROOT_URLCONF = 'jaysonlim_reading.urls' ...@@ -58,7 +58,7 @@ ROOT_URLCONF = 'jaysonlim_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': [
...@@ -122,6 +122,7 @@ USE_TZ = True ...@@ -122,6 +122,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.2/howto/static-files/ # https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
......
...@@ -15,6 +15,7 @@ Including another URLconf ...@@ -15,6 +15,7 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from bookshelf import views
urlpatterns = [ urlpatterns = [
path('bookshelf/', include('bookshelf.urls', namespace="bookshelf")), path('bookshelf/', include('bookshelf.urls', namespace="bookshelf")),
......
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<title>{% block title %}My amazing site{% endblock %}</title>
{% block styles %}{% endblock %}
</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