Creating a DJANGO based basic web application class 12 computer science (Python) Sumita Arora assignment solution according to the syllabus of CBSE, NCERT. Django CBSE Class 12 Computer Science (Python) Assignment questions and Solution for upcoming Board exam.
Short Answer / conceptual Questions
Q1: What is web framework?
Answer: A web framework is a software framework designed to support the web development or the website development which includes web services, web resources and web APIs. Web frameworks provide a standard way to build and deploy web applications on the world wide web.
Q.2. What are the advantages of using Django web framework ?
- Accelerate custom web application development.
- Support MVC ( model-view-controller) programming paradigm.
- Compatible with major operating system and database.
- Easy to extend and scale the application on this.
Q.3.What is code library? How is a library diffeent from a web framework?
A library is collection of modules. Library is invoked to use functions .This process of web development is hard.
A framework builts in most of the libraries and it is easy to use . Today programmers are using web frameworks and if something is let out of the framework it is called from outside.
Q.4.What do you understand by a project and an app in Django web application context?
A Django project refers to the whole working application while the Django app is the submodule or the working skeleton function.
Q.5.A Django project namely MyMart contains two apps in it namely list and status. How will you register the above created apps of Django project MyMart?
To register the app to main project in Django, open the setting.py and append the name of the apps in the list of the “INSTALLED APP”. This will add the app to the main frame of the project in Django.
Q.6. What do you understand by HTTP requests? Name the two types of HTTP requests.
An HTTP the client send the HTTP request in the form of the request in the proper design format to retrieve the acknowledgement of the request from the server side.
Types of HTTP requests:
GET is used to request data from a specified resource.
Post is used to send data to a server to create/ update a resource.
Q.7.How is an HTTP GET request different from an HTTP POST request?
Answer: Get Request is used to request data from a specified server from the client side ehereas Post Request is used to send data to a server to create/ update a resource from the client side.
Q.8. What is virtual environment?
Answer: Virtual environment is an isolated working space from the working environment that can be on external but mainly in main working system.
Q.9.How do you run server for your Django project ? Write command.
Answer: $ python manage.py runserver
Q.10. What is the name of administrative task management file found in Django projects?
Answer: File is called manage.py, where it is used to provide administrative working supportfor the project such as creating app and running web server and also some tasks like this.
Q.11.What is the name of architecture model adopted by Django?
Django follows the MVT or Model view Template architecture which is based on the MVC or Model view controller architecture.
Q.12.Discuss the MVT architecture of Django.
MVT is model-view-template working architecture of Django.
Model: Model is going to act as the interface of your data. It is responsible for maintaining data. Such as Mysql, mongoDB etc.
Template: A template consists of static parts of the desired HTML output as well as some special syntax describing how dynamic content is tackled.
Q.13.What are templates in Django projects?
Answer: Django ‘s template layer renders the information to be presented to the user in a designed- friendly format. Using templates, you can generate HTML dynamically and all the dynamic generated data on the interface.That is how template interact in this zone.
Q.14.What do you understand by views in a Django project? How are views important for a Django Project?
View is a python function that takes a web request and returns a web response. This response can be HTML contents of a webpage, or a redirect. This is important as it links the content of webpage to the model of the project in Django.
Q15. What do you understand by URL routing?How does it take place?
URL Routing is the process of linking the url’s and displaying the content or the templates of the projects in Django. Its structure is defined in the urls.py by the transition of linking URL patterns.
Application Based Question : DJANGO CBSE Class 12
Q.1. Write a view function that can process a GET request and display “about.html” as template. Required file and method are already imported.
$ from django.shortcuts import render
$ def about_view(request):
$ return render(request,”about.html”)
Q.2.Write a view function tat can process a POST request and display “index.html” as template. Required file(s) and method(s) are already imported.
$from django.shortcuts import render
$def index_view (request)
$ return render(request, “index.html”)
Q.3.You need to display a webpage team.html in response to URL <server>/about/team/ for app work in your Django project (namely Service).
Write the following:
(a)View function namely teamwork for team app
(b)URL conf for views teamwork
The template file team.html is available under templates folder of BASE DIRECTORY.
#Answer: (a) View function def teamwork ( request): #teamwork function is defined return render(request,'team.html')
(b) url conf from work.views import teamwork #importing function teamwork urlpatterns=[ path('about/team', teamwork), path('admin/',admin.site.urls)]
Q.4.From the following URL confs, identify the URLs and the view functions
url is localhost:8000/about/and view function is about
url is localhost:8000/news/ and view function is modern.
We are also providing the solutions of all the chapters of Computer Science (Python) in this site. the links of relevant topics are provided below: