Code Monkey home page Code Monkey logo

serversideprocessing's Introduction

Design a Website for Server Side Processing

AIM:

To design a website to perform mathematical calculations in server side.

DESIGN STEPS:

Step 1:

Requirement collection.

Step 2:

Creating the layout using HTML and CSS.

Step 3:

Write the calculations part in views.py .

Step 4:

Set the path in urls.py .

Step 5:

Run the Server.

Step 6:

Publish the website in the given URL.

PROGRAM :

HTML Code:

<!DOCTYPE html>
<html>
<head>
   <meta charset='utf-8'>
   <meta http-equiv='X-UA-Compatible' content='IE=edge'>
   <title>SERVER SIDE PROCESSING</title>
   <meta name='viewport' content='width=device-width, initial-scale=1'>
   <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
   <style> 
         .container {
       width: 1080px;
       margin-left: auto;
       margin-right: auto;
     }
     .content {
       display: block;
       width: 100%;
       background-color: white;
       min-height: 400px;
       margin-top:150px
     }
           body {
       background-color: mediumvioletred;
     }
           h1{
         text-align: center;
         padding-top: 20px ;
     }
           .formelement{
         text-align: center;
         margin-top: 20px;
         margin-bottom: 20px;
         font-size: 20px;
     }
   </style>
</head>
<body>
   
   <div class="container">
     <div class="content">
         <h1>Area of a Rectangle</h1>
   <form method="POST">
       {% csrf_token %}
       <div class="formelement">
       Length = <input type="text" name="length" value={{l}}></input><br/></div>
       <div class="formelement">
       Breadth = <input type ="text" name="breadth" value={{b}}></input><br/></div>
       <div class="formelement">
       <input type="submit" value="calculatearea"> </input><br/></div>
       <div class="formelement">
        Area of Rectangle = <input type ="text" name="area" value={{area}}></input></div>
   </form>
   </div>
   </div>
</body>
</html>

views.py:

from django.shortcuts import render

# Create your views here.
def areacalculation(request):
    context={}
    context["area"]="0"
    context["l"]="0"
    context["b"]="0"
    if request.method == "POST":
       l= request.POST.get("length","0")
       b= request.POST.get("breadth","0")
       area= int(l)*int(b)
       context["area"]= area
       context["l"]=l
       context["b"]=b
    return render(request,"mathapp/area.html",context)

urls.py

from django.contrib import admin
from django.urls import path
from mathapp import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('areaofrectangle/',views.areacalculation,name="areaofrectangle"),
    path('',views.areacalculation,name="areaofrectangleroot"),
]

OUTPUT:

Output

Output with Inputs:

Output

Result:

A website to perform mathematical calculations in server side is designed.

serversideprocessing's People

Contributors

obedotto avatar sowmiya2003 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.