To design a website to find surface area of a Right Cylinder in server side.
Surface Area = 2Πrh + 2Πr2
r --> Radius of Right Cylinder
h --> Height of Right Cylinder
Clone the repository from GitHub.
Create Django Admin project.
Create a New App under the Django Admin project.
Create python programs for views and urls to perform server side processing.
Create a HTML file to implement form based input and output.
Publish the website in the given URL.
<title>Document</title> <style> .formelt{ color: orange; text-align: center; margin-top: 7px; margin-bottom: 6px; } h1 { color: rgb(255, 0, 179); text-align: center; padding-top: 20px; } body{ background-color:palegreen; } .edge { border:2px solid wheat; margin-top:10%; } </style>from django.shortcuts import render
def rectarea(request): context={} context ['area'] = "0" context['1'] = "0" context ['b'] = "0" if request.method == 'POST': print("POST method is used") l=request.POST.get('length', '0') b = request.POST.get('breadth', '0') print('request=', request) print('Length=',l) print('Breadth=',b) area = int(l)*int(b) context['area'] = area context['l']= l context['b'] = b print('Area', area) return render(request, 'app/math.html', context) from django.contrib import admin from django.urls import path from app import views
from django.contrib import admin from django.urls import path from app import views
urlpatterns = [ path('admin/', admin.site.urls), path('areaofrectangle/',views.rectarea,name="areaofrectangle"), path('',views.rectarea,name="areaofrectangleroot") ]
The program for performing server side processing is completed successfully.