Tutorial 8 - Static Page w CSS JS

This commit is contained in:
Cutty 2026-03-14 19:15:31 -06:00
parent 584974d5e4
commit 1a796533a4
6 changed files with 42 additions and 5 deletions

View file

@ -0,0 +1,16 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Asia Tours Two</title>
<link rel="stylesheet" href="{% static 'styles/styles.css' %}" />
</head>
<body>
<h1>Asia Tours Schedule for June</h1>
<p>This website provides Tour Listings for Asian destinations!</p>
<script src="{% static 'js/script.js' %}"></script>
<img src="{% static 'images/dog.jpg' %}" alt="Dogs on Tour" />
</body>
</html>

View file

@ -6,10 +6,13 @@ from .models import Tour
# Create your views here. # Create your views here.
def index(request): # def index(request):
tours = Tour.objects.all() # tours = Tour.objects.all()
context = {"tours": tours} # context = {"tours": tours}
return render(request, "tours/index.html", context) # return render(request, "tours/index.html", context)
# return HttpResponse("Asian Tours Agency") # return HttpResponse("Asian Tours Agency")
def index(request):
return render(request, "static_page/index.html")

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -0,0 +1,3 @@
document.addEventListener("DOMContentLoaded", function () {
alert("Here boy!");
});

View file

@ -0,0 +1,11 @@
body {
font-family: Arial, Arial, Helvetica, sans-serif;
background-color: #f4f4f4;
color: #333;
text-align: center;
padding: 20px;
}
img {
width: 300px;
}

View file

@ -10,6 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/6.0/ref/settings/ https://docs.djangoproject.com/en/6.0/ref/settings/
""" """
import os
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -116,3 +117,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/6.0/howto/static-files/ # https://docs.djangoproject.com/en/6.0/howto/static-files/
STATIC_URL = "static/" STATIC_URL = "static/"
MEDIA_URL = "images/"
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)