P 6
P 6
------layout.html-----
<html>
<title>{% block title %} {% endblock %}</title>
<style type="text/css">
nav {background-color: lightblue; padding: 10px;}
</style>
<body>
<nav>
<a href="/home/">Home</a>\
<a href="/aboutus/">About us</a>\
<a href="/contactus/">Contact Us</a>\
</nav>
<section>
{% block content %}{% endblock %}
</section>
<footer>
<hr>
© ISE, Developed by 6th sem, Inc.
</footer>
</body>
</html>
------aboutus.html-------
{% extends 'layout.html' %}
{% block title %}
About Us
{% endblock %}
{% block content %}
<h2> We are 6th sem students</h2>
{% endblock %}
------contactus.html-------
{% extends 'layout.html' %}
{% block title %}
Contact Us
{% endblock %}
{% block content %}
<h2> Reach Us: 7788990089 <br>
Address: AMC Engineering College</h2>
{% endblock %}
-------home.html------
{% extends 'layout.html' %}
{% block title %}
Home
{% endblock %}
{% block content %}
<h2> This is the home page</h2>
{% endblock %}
------views.py-------
from django.shortcuts import render
from django.http import HttpResponse
from django.template import context, Template
def home(request):
return render(request, 'home.html')
def aboutus(request):
return render(request, 'aboutus.html')
def contactus(request):
return render(request, 'contactus.html')
-------urls.py-------
from django.contrib import admin
from django.urls import path, include
from app6.views import aboutus, home, contactus
urlpatterns = [
path('admin/', admin.site.urls),
path('aboutus/', aboutus),
path('home/', home),
path('contactus/', contactus),
]