Tutorial 8 - Static Page w CSS JS
This commit is contained in:
parent
584974d5e4
commit
1a796533a4
6 changed files with 42 additions and 5 deletions
16
touragency/agency/templates/static_page/index.html
Normal file
16
touragency/agency/templates/static_page/index.html
Normal 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>
|
||||
|
|
@ -6,10 +6,13 @@ from .models import Tour
|
|||
|
||||
|
||||
# Create your views here.
|
||||
def index(request):
|
||||
tours = Tour.objects.all()
|
||||
context = {"tours": tours}
|
||||
return render(request, "tours/index.html", context)
|
||||
|
||||
# def index(request):
|
||||
# tours = Tour.objects.all()
|
||||
# context = {"tours": tours}
|
||||
# return render(request, "tours/index.html", context)
|
||||
|
||||
# return HttpResponse("Asian Tours Agency")
|
||||
|
||||
|
||||
def index(request):
|
||||
return render(request, "static_page/index.html")
|
||||
|
|
|
|||
BIN
touragency/static/images/dog.jpg
Normal file
BIN
touragency/static/images/dog.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
3
touragency/static/js/script.js
Normal file
3
touragency/static/js/script.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
alert("Here boy!");
|
||||
});
|
||||
11
touragency/static/styles/styles.css
Normal file
11
touragency/static/styles/styles.css
Normal 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;
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ For the full list of settings and their values, see
|
|||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# 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/
|
||||
|
||||
STATIC_URL = "static/"
|
||||
MEDIA_URL = "images/"
|
||||
|
||||
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue