Python-Django Report
Python-Django Report
Python-Django Report
Internship Report
Submitted to
KARPAGAM ACADEMY OF HIGHER EDUCATION
Submitted by
SRI RAJA RAJESWARI
(23CSU049)
BONAFIDE CERTIFICATE
This is to certify that the Internship work entitled “PYTHON-DJANGO” is done by SRI
RAJA RAJESWARI R (23CSU049), during the period September 2nd, 2024to October
Place: Coimbatore
S.No Index
1 Introduction
3 Conclusion
1. INTRODUCTION
PYTHON:
DJANGO:
Django is a high-level python web framework that enables paid development of
secure and maintainable websites. Built by experienced developers, Django
takes care of much of the hassle of web development, So you can focus on
writing your app without needing to reinvent the wheel.
Existing System:
SIS Student Information System: SIS is a Django-based student
information system that enables educational institutions to manage student
records, attendance, grades, schedules, and more. It provides a user-friendly
interface for administrators, teachers, and students to access and update
information.
PROPOSED SYSTEM:
Setup and Configuration:
MODELS:
Define the necessary models for the student management system, such as
Student, Course, Enrollment, etc.
Design the fields for each model, including primary keys, foreign keys, and
additional attributes like name, email, grade, etc.
ADMIN INTERFACE:
Register the models in the Django admin interface for easy management.
Customize the admin interface to display relevant fields and provide filters,
search options, and actions.
Define corresponding URL patterns for each view in the project's URL
configuration file.
Design templates using HTML and Django template language to present the
data fetched from views.
FORMS:
The design of input focus on controlling the amount of dataset as input required,
avoiding delay and keeping the process simple. The input is designed in such a
way to provide security. Input design will consider the following steps:
This phase contains the attributes of the dataset which are maintained in the
database table. The dataset collection can be of two types namely train dataset
and test dataset.
OUTPUT DESIGN
A quality output is one, which meets the requirement of the user and presents
the information clearly. In output design, it is determined how the information is
to be displayed for immediate need.
ABOUT SOFTWARE
PYTHON
reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms,
Python has few keywords, simple structure, and a clearly defined syntax.
Python code is more clearly defined and visible to the eyes. Python's source
support for an interactive mode which allows interactive testing and debugging
of snippets of code.
Portable Python can run on a wide variety of hardware platforms and has the
EXTENDABLE:
DATABASES:
GUI PROGRAMMING:
Python supports GUI applications that can be created and ported to many
Python provides a better structure and support for large programs than shell
scripting.
OBJECT-ORIENTED APPROACH:
One of the key aspects of Python is its object-oriented approach. This basically
means that Python recognizes the concept of class and object encapsulation thus
HIGHLY DYNAMIC:
Python is one of the most dynamic languages available in the industry today.
There is no need to specify the type of the variable during coding, thus saving
time and increasing efficiency.
Python comes inbuilt with many libraries that can be imported at any instance
create and contribute to its development. Python is free to download and use in
Consider a file Pots.py available in Phone directory. This file has following line
of source code −
def Pots():
Similar way, we have another two files having different functions with the same
name as above −
• Phone/__init__.py
To make all of your functions available when you've imported Phone,to put
explicit import statements in
__init__.py as follows −
from G3 import G3
After you add these lines to __init__.py, you have all of these classes available
when you import the
Phone package.
import Phone
Phone.Pots()
Phone.Isdn()
Phone.G3()
RESULT:
I'm 3G Phone
In the above example, we have taken example of a single functions in each file,
but you can keep multiple
functions in your files. You can also define different Python classes in those
files and then you can create
def __add__(self,other):
return Vector(self.a + other.a, self.b + other.b)
v1 = Vector(2,10)
v2 = Vector(5,-2)
print v1 + v2
When the above code is executed, it produces the following result
DATA HIDING
An object's attributes may or may not be visible outside the class definition.
You need to name attributes
with a double underscore prefix, and those attributes then are not be directly
visible to outsiders.
Class JustCounter:
__secretCount = 0
def count(self):
self.__secretCount += 1
print self.__secretCount
counter = JustCounter()
counter.count()
counter.count()
print counter.__secretCount
1
2
Traceback (most recent call last):
File "test.py", line 12, in <module>
print counter.__secretCount
Attribute Error: JustCounter instance has no attribute '__secretCount'
Python protects those members by internally changing the name to include the
class name. You can access such attributes as object._className__attrName. If
you would replace your last line as following, then it works for you .
DJANGO
Overview:
Design your model¶
Although you can use Django without a database, it comes with an object-
relational mapper in which you describe your database layout in Python code.
The data-model syntax offers many rich ways of representing your models – so
far, it’s been solving many years’ worth of database-schema problems. Here’s a
quick example:
mysite/news/models.py¶
from django.db import models
class Reporter(models.Model):
full_name = models.CharField(max_length=70)
def __str__(self):
return self.full_name
class Article(models.Model):
pub_date = models.DateField()
headline = models.CharField(max_length=200)
content = models.TextField()
reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)
def __str__(self):
return self.headline
Install it¶
Next, run the Django command-line utilities to create the database tables
automatically:
The makemigrations command looks at all your available models and creates
migrations for whichever tables don’t already exist. migrate runs the migrations
and creates tables in your database, as well as optionally providing much richer
schema control.
With that, you’ve got a free, and rich, Python API to access your data. The API
is created on the fly, no code generation necessary:
>>> Reporter.objects.all()
<QuerySet []>
>>> r.save()
>>> r.id
>>> Reporter.objects.all()
>>> r.full_name
'John Smith'
>>> Reporter.objects.get(id=1)
>>> Reporter.objects.get(full_name__startswith="John")
>>> Reporter.objects.get(full_name__contains="mith")
...
# Create an article.
>>> a = Article(
... )
>>> a.save()
>>> Article.objects.all()
>>> r = a.reporter
>>> r.full_name
'John Smith'
# And vice versa: Reporter objects get API access to Article objects.
>>> r.article_set.all()
# This finds all articles by a reporter whose name starts with "John".
>>> Article.objects.filter(reporter__full_name__startswith="John")
>>> r.save()
>>> r.delete()
A dynamic admin interface: it’s not just scaffolding – it’s the whole house¶
Once your models are defined, Django can automatically create a professional,
production ready administrative interface – a website that lets authenticated
users add, change and delete objects. The only step required is to register your
model in the admin site:
mysite/news/models.py¶
from django.db import models
class Article(models.Model):
pub_date = models.DateField()
headline = models.CharField(max_length=200)
content = models.TextField()
admin.site.register(models.Article)
The philosophy here is that your site is edited by a staff, or a client, or maybe
just you – and you don’t want to have to deal with creating backend interfaces
only to manage content.
One typical workflow in creating Django apps is to create models and get the
admin sites up and running as fast as possible, so your staff (or clients) can start
populating data. Then, develop the way data is presented to the public.
Design your URLs¶
A clean, elegant URL scheme is an important detail in a high-quality web
application. Django encourages beautiful URL design and doesn’t put any cruft
in URLs, like .php or .asp.
To design URLs for an app, you create a Python module called a URLconf. A
table of contents for your app, it contains a mapping between URL patterns and
Python callback functions. URLconfs also serve to decouple URLs from Python
code.
Here’s what a URLconf might look like for the Reporter/Article example
above:
mysite/news/urls.py¶
urlpatterns = [
path("articles/<int:year>/", views.year_archive),
path("articles/<int:year>/<int:month>/", views.month_archive),
path("articles/<int:year>/<int:month>/<int:pk>/", views.article_detail),
The code above maps URL paths to Python callback functions (“views”). The
path strings use parameter tags to “capture” values from the URLs. When a user
requests a page, Django runs through each path, in order, and stops at the first
one that matches the requested URL. (If none of them matches, Django calls a
special-case 404 view.) This is blazingly fast, because the paths are compiled
into regular expressions at load time.
Once one of the URL patterns matches, Django calls the given view, which is a
Python function. Each view gets passed a request object – which contains
request metadata – and the values captured in the pattern.
mysite/news/views.py¶
{% block content %}
<h1>Articles for {{ year }}</h1>
SYSTEM STUDY
System study contains existing and proposed system details. Existing system is
useful to develop proposed system. To elicit the requirements of the system and
to identify the elements, Inputs, Outputs, subsystems and the procedures, the
This increases the total productivity. The use of paper files is avoided and all the
data are efficiently manipulated by the system. It also reduces the space needed
SYSTEM DESIGN
The degree of interest in each concept has varied over the year, each has stood
the test of time. Each provides the software designer with a foundation from
During the design process the software requirements model is transformed into
design models that describe the details of the data structures, system
architecture, interface, and components. Each design product is reviewed for
tasks and information. The system offers several key features and benefits.
teachers, and students to log in with unique credentials and access the relevant