0% found this document useful (0 votes)
37 views17 pages

Report of Djangoo

Uploaded by

subhasuji86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views17 pages

Report of Djangoo

Uploaded by

subhasuji86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

HAWKSCODE SOFTWARES PVT.LTD.

AN INTERNSHIPREPORT
Submitted by
M.MUTHU SUBHA
(953421104030)
Partial fulfilment for
the award of the degree BACHELOR OF
ENGINEERING
In
COMPUTERSCIENCE AND ENGINEERING
VV COLLEGE OF ENGINEERING
TISAYANVILAI-627657
JUNE 19 – JULY 31
VV COLLEGE OF ENGINEERING
TISAYANVILAI- 62765

BONAFIDE CERTIFICATE

This is to certify that the “ Internship report” submitted by M. MUTHU


SUBHA (Reg. No: 953421104030) is work done by her and submitted
during August 2023, in partial fulfillment of the requirements for the award
of the degree of BACHELOR OF ENGINEERING in COMPUTER
SCIENCE AND ENGINEERING, at Hawkscode Softwares Pvt. Ltd,
Jaipur.

STAFF INCHARGE HEAD OF THE DEPARTMENT

1
ABSTRACT

The internship at HAWKSCODE SOFTWARE PVT.LTD has provided


practical knowledge about DJANGO PYTHON FRAMEWORK. At
Hawkscode, we believe that design has the power to transform spaces and
elevate experiences. We are passionate about blending a esthetics with
functionality, creating harmonious environments that inspire, engage, and
enrich the lives of those who inhabit them. Our goal is to empower
organizations provide benefit in their separate segments with the best
possible utilization of IT advances. We have built up our adjusting targets
at all levels in order to instill collaboration in official operations. Our major
is helping our clients in achieving their goals .Hawkscode Software Private
Limited is a global IT company delivering services, solutions to enterprises
world wide. we have built robust and profitable practices in application
softwares and e Business. Hawkscode came into existence with the vision
to make bring technology and IT solutions to everyone’s reach effective,
efficient, affordable and standardized practices. Data science can add value
to any business by using its data to develop solutions and optimize day-to-
day operations .Django python framework can be used for statistics ,hiring
candidates ,and making more informed business decisions based on a data-
oriented approach. And I am doing an internship in the field of DJANGO
PYTHON FRAMEWORK and I got the knowledge about how the data
cleaning and preparation, data visualization, statistical modeling, and
machine learning.

2
TABLE OF CONTENT

SNO CONTENT PAGENO

01 INTRODUCTION

02 ARCHITECTURE AND
LAYERS OF
DJANGO

03 MODEL LAYER

04 FIELDS

05 VIEW LAYER

06 FORMS

07 TEMPLATE LAYER

08 DEVELOPMENT
PROCESS

09 SIGNALS

10 DEFINING AND
SENDING SIGNALS

11 ADVANTAGES OF
DJANGO

12 APPLICATION OF
DJANGO

13 CONCLUSION

3
1. INTRODUCTION
Django is a Python-based web framework for model-template-view
(MTV) based architectural patterns. It's open-source and is maintained
by the Django Software Foundation.

To work with Django python is the basics.Syntax and basics of


python is the base for Django.

Mostly Django is used for development of project. Modules,packages


are also important in django Python framework.

STEPS FOR INSTALLATION:

 Pip install django==3.1.6


 Download and install atom id
 Install platform ioidio terminal
 Install auto complete python
 Install django

Basic step in creation of project is to Create a folder. Folder consists


of the following,

 __init__.py
 Settings.py
 Urls.py
 Wsgi.py
 Asgi.py

4
2.
2 ARCHITECTURE

LAYERS OF DJANGO

5
3. MODEL LAYER

Django provides an abstraction layer (the “models”) for structuring and


manipulating the data of your Web application.
Models:

 A model is the single, definitive source of information about your data.


 It contains the essential fields and behaviors of the data you’re storing.
Generally, each model maps to a single database table.
The basics:
 Each model is a Python class that subclasses
 Each attribute of the model represents a database field.
 With all of this, Django gives you an automatically-generated database-
access API

EXAMPLE:
fromdjango.dbimport models

classPerson(models.Model):

first_name = models.CharField(max_length=30)

4. FIELDS

 The most important part of a model – and the only required part of a
model – is the list of database fields it defines.
 Fields are specified by class attributes

6
Field types:

Each field in your model should be an instance of the appropriate Field class.
Django uses the field class types to determine a few things:
• The column type, which tells the database what kind of data to store
(e.g. INTEGER, VARCHAR, TEXT).
• The default HTML widget to use when rendering a form field (e.g.
<input type="text">, <select>).
• The minimal validation requirements, used in Django’s admin and in
automatically-generated forms.

Security
Because a settings file contains sensitive information, such as the
database password, you should make every attempt to limit access to
it. This is especially important in a shared-hosting environment

5. VIEW LAYER

Django has the concept of “views” to encapsulate the logic responsible for
processing a user’s request and for returning the response.

URL dispatcher
 A clean, elegant URL scheme is an important detail in a high-quality
Web application. Django lets you design URLs however you want, with
no framework limitations
 See Cool URIs don’t change, by World Wide Web creator Tim Berners-
Lee, for excellent arguments on why URLs should be clean and usable
.

7
Overview
 This module is pure Python code and is a mapping between URL path
expressions to Python functions (your views).
 This mapping can be as short or as long as needed. It can reference
other mappings. And, because it’s pure Python code, it can be
constructed dynamically
 Django also provides a way to translate URLs according to the active
language.

6. TEMPLATE LAYER
The template layer provides a designer-friendly syntax for rendering the
information to be presented to the user.

 Being a web framework, Django needs a convenient way to generate


HTML dynamically.
 The most common approach relies on templates. A template contains the
static parts of the desired HTML output as well as some special syntax
describing how dynamic content will be inserted.
 A Django project can be configured with one or several template engines
(or even zero if you don’t use templates).
 Django defines a standard API for loading and rendering templates
regardless of the backend. Loading consists of finding the template for a
given identifier and preprocessing it, usually compiling it to an in-
memory representation.
 Rendering means interpolating the template with context data and
returning the resulting string.
 The Django template language is Django’s own template system. Until
Django 1.8 it was the only built-in option available.

8
 It’s a good template library even though it’s fairly opinionated and sports
a few idiosyncrasies.

7. FORMS
Django provides a rich framework to facilitate the creation of forms and the
manipulation of form data.

HTML forms

 In HTML, a form is a collection of elements inside


<form>...</form> that allow a visitor to do things like enter text

 select options, manipulate objects or controls, and so on, and then send
that information back to the server.
 Some of these form interface elements - text input or checkboxes - are
fairly simple and are built into HTML itself.

Forms in Django
 We’ve described HTML forms briefly, but an HTML <form> is just one
part of the machinery required.
 In the context of a Web application, ‘form’ might refer to that HTML
<form>, or to the Django Form that produces it,
 or to the structured data returned when it is submitted, or to the end-to-
end working collection of these parts.

Instantiating, processing, and rendering forms


 When rendering an object in Django, we generally:
 get hold of it in the view (fetch it from the database, for example)
 pass it to the template context
 expand it to HTML markup using template variables

9
 Rendering a form in a template involves nearly the same work as
rendering any other kind of object, but there are some key differences.
 In the case of a model instance that contained no data, it would rarely if
ever be useful to do anything with it in a template.
o On the other hand, it makes perfect sense to render an unpopulated
form - that’s what we do when we want the user to populate it.
 So when we handle a model instance in a view, we typically retrieve it
from the database. When we’re dealing with a form we typically
instantiate it in the view.
 When we instantiate a form, we can opt to leave it empty or pre-populate
it, for example with:
• data from a saved model instance (as in the case of admin forms
for editing)
• data that we have collated from other sources

8. DEVELOPMENT PROCESS

Django settings

A Django settings file contains all the configuration of your Django


installation. This document explains how settings work and which settings are
available.

The basics

A settings file is just a Python module with module-level variables.


Here are a couple of example settings:
ALLOWED_HOSTS = ['www.example.com']
DEBUG = False
DEFAULT_FROM_EMAIL = '[email protected]'

10
9. SIGNALS
Django includes a “signal dispatcher” which helps allow decoupled
applications get notified when actions occur elsewhere in the
framework. In a nutshell, signals allow certain senders to notify a set
of receivers that some action has taken place. They’re especially
useful when many pieces of code may be interested in the same events.

Django provides a set of built-in signals that let user code get notified
by Django itself of certain action.

Parameters
 Receiver – The callback function which will be connected to this signal.
 Sender – Specifies a particular sender to receive signals from.
 Weak – Django stores signal handlers as weak references by default.
Thus, if your receiveris a local function, it may be garbage collected. To
prevent this, pass weak=False when youcall the signal’s connect()
method.
 Dispatch_uid – A unique identifier for a signal receiver in cases where
duplicate signalsmay be sent.

10. DEFINING AND SENDING SIGNALS

Defining signals

class Signal(providing_args=list)
All signals are django.dispatch.Signal instances. The providing_argsis a list of
the names of arguments thesignal will provide to listeners. This is purely
documentational, however, as there is nothing that checks that the signalactually
provides these arguments to its listeners.

11
For example:
importdjango.dispatch
pizza_done = django.dispatch.Signal(providing_args=["toppings", "size"])

Sending signals
There are two ways to send signals in Django.

1. Signal.send(sender, **kwargs)

2. Signal.send_robust(sender, **kwargs)
 To send a signal, call either Signal.send() (all built-in signals use this) or
Signal.send_robust(). You must provide the sender argument (which is a
class most of the time) and may provide as many other keyword
arguments as you like.

For example, here’s how sending our pizza_done signal might look:

classPizzaStore:

...

defsend_pizza(self, toppings, size):

pizza_done.send(sender=self.__class__,toppings=toppings, size=size)
 Both send() and send_robust() return a list of tuple pairs [(receiver,
response), ... ], representing the list of called receiver functions and their
response values.
 send() differs from send_robust() in how exceptions raised by receiver
functions are handled.
 send() does not catch any exceptions raised by receivers; it simply allows
errors to propagate. Thus not all receivers may be notified of a signal in
the face of an error.

12
 send_robust() catches all errors derived from Python’s Exception class,
and ensures all receivers are notified of the signal. If an error occurs, the
error instance is returned in the tuple pair for the receiver that raised.
 The tracebacks are present on the __traceback__ attribute of the errors
returned when calling send_robust().
Disconnecting signals
Signal.disconnect(receiver=None, sender=None,dispatch_uid=None)
 To disconnect a receiver from a signal, call Signal.disconnect(). The
arguments are as described in Signal.
 connect(). The method returns True if a receiver was disconnected and
False if not.
 The receiver argument indicates the registered receiver to disconnect. It
may be None if dispatch_uid is used to identify the receiver.
Messages
 The function must return a list of messages. If no problems are found as a
result of the check, the check function must return an empty list.
 The warnings and errors raised by the check method must be instances of
CheckMessage. An instance of CheckMessage encapsulates a single
reportable error or warning. It also provides context and hints applicable
to the message, and a unique identifier that is used for filtering purposes.
 The concept is very similar to messages from the message framework or
the logging framework. Messages are tagged with a level indicating the
severity of the message.
 There are also shortcuts to make creating messages with common levels
easier. When using these classes you can omit the level argument because
it is implied by the class name.
• Debug
• Info

13
11. ADVANTAGES OF DJANGO

12. APPLICATION OF DJANGO

14
13. CONCLUSION
Django, a popular & high level python web framework, is Flat out amazing.
Below are few of the reasons.

Disqus, Facebook, Instagram, Pinterest, NASA, The Washington Post and other
top companies use Python with Django. For web developers, this means that
mastering Python and its popular advanced frameworks like Django should
ensure you’re able to find work or even build your own product or service as a
startup.

Python is an ideal option for bootstrappers and startups because of its quick
deployment and—as mentioned earlier—lesser amount of required code next to
Java, C, and PHP among others.

Python Django framework supports the use of human-readable website URLs,


which isn’t only helpful from the actual user’s perspective, but also to search
engines, which use the keywords in the URL when ranking sites.

15
16

You might also like