Commit 7e998f74 authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

Created base template, created and set up static folder and css file, created and set up homepage

parent b986b4be
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Books & Authors{% endblock %}
{% block content %}
<h1 id="hello">Welcome to Gabi's Database of Favorite Books and Authors!</h1>
<p>I don't read books.</p>
<a href='/bookshelf/books/'>Books</a>
<a href='/bookshelf/authors/'>Authors</a>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import index
from . import views
urlpatterns = [
path('', index, name = 'index'),
path('home/', views.home, name = 'home'),
]
app_name = "bookshelf"
\ No newline at end of file
from django.http import HttpResponse
from .models import Author, Books
from django.template import loader
from django.shortcuts import render
def index(request):
return HttpResponse('')
\ No newline at end of file
def home(request):
return render(request, 'bookshelf/home.html')
\ No newline at end of file
......@@ -59,7 +59,7 @@ ROOT_URLCONF = 'gabigarrero_reading.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......@@ -123,6 +123,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
......
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/static/styles.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