Font size
WorksheetsIntroduction to Django Framework Quiz
Total questions: 15
Worksheet time: 11mins
What is the primary purpose of Django in web development?
Designing user interfaces
Providing a framework for server-side web development
Managing databases
Automating system administration tasks
How does Django help in improving the security of web applications?
By providing built-in security features like CSRF and XSS protection
By including a firewall
By offering antivirus protection
By encrypting all traffic by default
What is the function of Django's ORM (Object-Relational Mapping)?
To generate HTML templates
To handle user authentication
To interact with databases using Python objects
To manage static files
Which command is used to start a new Django project?
django-admin startproject <projectname>
django startproject <projectname>
python startproject <projectname>
django-admin createproject <projectname>
What file is used to configure the settings of a Django project?
In Django, what is the purpose of the urls.py file?
To define the database schema
To handle user authentication
To map URL patterns to views
To manage static and media files
What is a Django model?
A representation of the HTML structure
A representation of a database table
A set of CSS styles
A collection of JavaScript functions
What is the purpose of the init.py file in a Django project?
To define URL patterns
To initialize a Python package
To handle database migrations
To configure settings
What is the function of the wsgi.py file in a Django project?
To handle URL routing
To manage asynchronous operations
To define the WSGI application for the project
To set up the database schema
Where should static files (e.g., CSS, JavaScript) be placed in a Django project?
In the templates folder
In the static folder
In the media folder
In the config folder
What is the purpose of the templates folder in a Django project?
To store static files
To define database models
To contain HTML templates used to render views
To manage form submissions
How can you organize static files within an individual Django app?
By placing them in the app_name/templates directory
By placing them in the app_name/static directory
By placing them in the root static directory
By placing them in the app_name/media directory
What setting in settings.py specifies the URL for serving static files in development?
STATIC_URL
STATICFILES_DIRS
STATIC_ROOT
STATICFILES_STORAGE
How can you load and use a static file in a Django template?
{% static "filename" %}
<img src="static/filename" />
{% load_static "filename" %}
<link rel="stylesheet" href="static/filename" />
