Вы находитесь на странице: 1из 25

Python and Django

Framework
Mohit Gusain

140970101021

Computer Science and Engineering

4th Year

Ducat Noida

Trainer-Mr. Swapnil Srivastava


Project name
Atm web project on django
web development framework

Introduction of python
Python is a general-purpose interpreted, interactive, object-oriented, and
high-level programming language. It was created by Guido van Rossum
during 1985- 1990. Like Perl, Python source code is also available under the
GNU General Public License (GPL).

Python is a high-level, interpreted, interactive and object-oriented scripting


language. Python is designed to be highly readable. It uses English keywords
frequently where as other languages use punctuation, and it has fewer
syntactical constructions than other languages.
Python is interpreted: Python is processed at runtime by the interpreter.
You do not need to compile your program before executing it. This is similar
to PERL and PHP.

Python is Interactive: You can actually sit at a Python prompt and


interact with the interpreter directly to write your programs.

Python is Object-Oriented: Python supports Object-Oriented style or


technique of programming that encapsulates code within objects. Python is
a Beginner's Language: Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications
from simple text processing to WWW browsers to games.

History of Python
Python was developed by Guido van Rossum in the late eighties and early
nineties at the National Research Institute for Mathematics and Computer
Science in the Netherlands.

Python is derived from many other languages, including ABC, Modula-3, C,


C++, Algol-68, SmallTalk, Unix shell, and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under
the GNU General Public License (GPL).

Python is now maintained by a core development team at the institute,


although Guido van Rossum still holds a vital role in directing its progress.

Python Features
Python's features include:

Easy-to-learn: Python has few keywords, simple structure, and a clearly


defined syntax. This allows the student to pick up the language quickly.

Easy-to-read: Python code is more clearly defined and visible to the eyes.

Easy-to-maintain: Python's source code is fairly easy-to-maintain.

A broad standard library: Python's bulk of the library is very portable and

cross-platform compatible on UNIX, Windows, and Macintosh.

Interactive Mode: Python has 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 same interface on all platforms.

Extendable: You can add low-level modules to the Python interpreter.


These modules enable programmers to add to or customize their tools to be
more efficient.

Databases: Python provides interfaces to all major commercial databases.

GUI Programming: Python supports GUI applications that can be created


and Ported to many system calls, libraries, and windows systems, such as
Windows MFC, Macintosh, and the X Window system of Unix.

Scalable: Python provides a better structure and support for large


programs than shell scripting. Apart from the above-mentioned features,
Python has a big list of good features, few are listed below:

It supports functional and structured programming methods as well as


OOP.

It can be used as a scripting language or can be compiled to byte-code for

Building large applications.

It provides very high-level dynamic data types and supports dynamic type

Checking.

It supports automatic garbage collection.

It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Python Environment
Python is available on a wide variety of platforms including Linux and Mac
OS X. Let's understand how to set up our Python environment.

Local Environment Setup


Open a terminal window and type "python" to find out if it is already
installed and which version is installed.

Unix (Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS, IRIX, etc.)

Win 9x/NT/2000

Macintosh (Intel, PPC, 68K)

OS/2

DOS (multiple versions)

PalmOS

Nokia mobile phones

Windows CE

Acorn/RISC OS

BeOS

Amiga

VMS/OpenVMS

QNX

VxWorks

Psion

Python has also been ported to the Java and .NET virtual machines
Getting Python
The most up-to-date and current source code, binaries, documentation,
news, etc.,is available on the official website of Python:
http://www.python.org/.

You can download Python documentation from www.python.org/doc/. The


documentation

is available in HTML, PDF, and PostScript formats.

Django
Django is a high-level Python web framework that encourages rapid
development and clean, pragmatic design. Django makes it easier to build
better web apps quickly and with less code.

Note: Django is a registered trademark of the Django Software Foundation,


and is licensed under BSD License.

History of Django
2003: Started by Adrian Holovaty and Simon Willison as an internal
project at the

Lawrence Journal-World newspaper.

2005: Released July 2005 and named it Django, after the jazz guitarist
Django

Reinhardt.

2005: Mature enough to handle several high-traffic sites.

Current: Django is now an open source project with contributors across


the world

Django Design Philosophies


Django comes with the following design philosophies:

Loosely Coupled: Django aims to make each element of its stack


independent of the others.

Less Coding: Less code so in turn a quick development.

Don't Repeat Yourself (DRY): Everything should be developed only in


exactly one place instead of repeating it again and again.

Fast Development: Django's philosophy is to do all it can to facilitate


hyper-fast development.

Clean Design: Django strictly maintains a clean design throughout its own
code and makes it easy to follow best web-development practices

Advantages of Django
Here are few advantages of using Django which can be listed out here:

Object-Relational Mapping (ORM) Support: Django provides a bridge


between the data model and the database engine, and supports a large set
of database systems including MySQL, Oracle, Postgres, etc. Django also
supports NoSQLdatabase through Django-nonrel fork. For now, the only
NoSQL databasessupported are MongoDB and google app engine.

Multilingual Support: Django supports multilingual websites through its


built-in internationalization system. So you can develop your website, which
would support multiple languages.

Framework Support: Django has built-in support for Ajax, RSS, Caching
and various other frameworks.

Administration GUI: Django provides a nice ready-to-use user interface


for administrative activities.

Development Environment: Django comes with a lightweight web server


to facilitate end-to-end application development and testing.

Django-Overview
As you already know, Django is a Python web framework. And like most
modern framework, Django supports the MVC pattern. First let's see what is
the Model-View Controller (MVC) pattern, and then we will look at Djangos
specificity for the Model-View Template (MVT) pattern.

MVC Pattern
When talking about applications that provides UI (web or desktop), we
usually talk about MVC architecture. And as the name suggests, MVC pattern
is based on three components: Model, View, and Controller.
DJANGO MVC - MVT Pattern
The Model-View-Template (MVT) is slightly different from MVC. In fact the
main difference between the two patterns is that Django itself takes care of
the Controller part (Software Code that controls the interactions between the
Model and View), leaving us with the template. The template is a HTML file
mixed with Django Template Language (DTL).

The following diagram illustrates how each of the components of the MVT
pattern interacts with each other to serve a user request:

The developer provides the Model, the view and the template then just maps
it to a URL and Django does the magic to serve it to the user.

Django enviroment
Django development environment consists of installing and setting up
Python, Django, and a Database System. Since Django deals with web
application, it's worth mentioning that you would need a web server setup as
well.

Step 1 Installing Python


Django is written in 100% pure Python code, so you'll need to install Python
on your system. Latest Django version requires Python 2.6.5 or higher for
the 2.6.x branch or higher than 2.7.3 for the 2.7.x branch.

If you're on one of the latest Linux or Mac OS X distribution, you probably


already have Python installed. You can verify it by typing python command
at a command prompt. If you see something like this, then Python is
installed.

$ python

Python 2.7.5 (default, Jun 17 2014, 18:11:42)

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2

Otherwise, you can download and install the latest version of Python from
the link http://www.python.org/download.

Step 2 -Installing Django


Installing Django is very easy, but the steps required for its installation
depends on your operating system. Since Python is a platform-independent
language, Django has one package that works everywhere regardless of
your operating system.

You can download the latest version of Django from the link
http://www.djangoproject.com/download.

UNIX/Linux and Mac OS X Installation


You have two ways of installing Django if you are running Linux or Mac OS
system:

You can use the package manager of your OS, or use easy_install or pip if
installed.

Install it manually using the official archive you downloaded before.

We will cover the second option as the first one depends on your OS
distribution. If you have decided to follow the first option, just be careful
about the version of Django you are installing.
Let's say you got your archive from the link above, it should be something
like Djangox.xx.tar.gz:

Extract and install.

$ tar xzvf Django-x.xx.tar.gz

$ cd Django-x.xx

$ sudo python setup.py install

You can test your installation by running this command:

$ django-admin.py --version

If you see the current version of Django printed on the screen, then
everything is set.

Note: For some version of Django it will be django-admin the ".py" is


removed.

Windows Installation
We assume you have your Django archive and python installed on your
computer.

First, PATH verification.

On some version of windows (windows 7) you might need to make sure the
Path system variable has the path the following
C:\Python27\;C:\Python27\Lib\sitepackages\django\bin\

in it, of course depending on your Python version.

Then, extract and install Django.

c:\>cd c:\Django-x.xx

Next, install Django by running the following command for which you will
need administrative privileges in windows shell "cmd":

c:\Django-x.xx>python setup.py install

To test your installation, open a command prompt and type the following
command.
c:\>django-admin.py --version

If you see the current version of Django printed on screen, then everything
is set.

OR

Launch a "cmd" prompt and type python then:

c:\> python

>>> import django

>>> print django.get_version()

Step 3 Database Setup


Django supports several major database engines and you can set up any of
them based

on your comfort.

1. MySQL (http://www.mysql.com/)

2. PostgreSQL (http://www.postgresql.org/)

3. SQLite 3 (http://www.sqlite.org/)

4. Oracle (http://www.oracle.com/)

5. MongoDb (https://django-mongodb-engine.readthedocs.org)

6. GoogleAppEngine Datastore
(https://cloud.google.com/appengine/articles/djangononrel)

You can refer to respective documentation to installing and configuring a


database of your choice.

Note: Number 5 and 6 are NoSQL databases.

Web Server
Django comes with a lightweight web server for developing and testing
applications. This server is pre-configured to work with Django, and more
importantly, it restarts whenever you modify the code.

However, Django does support Apache and other popular web servers such
as Lighttpd.

My django web project of atm.

This is admin site from here admin can


change the detail or database of the site. This
is the admin page no user can enter in this
page. This is highly secure.
This is the admin detail
This is the no. of atm card save in the site of
user ,who use the the atm services

After click on the any atm card , it show the


details of user
This is the list of user atm card no.

From here admin can change the detail of


user atm like account no., name on card, pin,
Issue date and all other many things as show
on the below image.

These below images show the details such as


time of withdraw, machine id, amount
withdraw and current balance of cash
withdrawal by the user.
These are the machine details like location,
balance in atm and time of refill etc.
Now from here this is user page, where
server ask client to all basic detail of his atm
card like card number, pin number, mobile
verification code etc.
Here user has many options, which type of
services he wants.
If suppose user want to request check
available balance in account
Conclusion

During the Industrial Training at Ducat Noida, its technician department


has long been exposed to various activities and tasks in this company
indirectly, trainees also have to know every responsibility and role in the
company. Exposure to real working environment is good for student as
trainers, especially to open the minds and brains to be more creative and
highly knowledgeable, students can also identify and address issues that
often arise in real work situations. It will further enhance the student's
ability to think, learn independently and solve problems effectively and more
importantly can produce creative work, Keratins and quality.

During training in technician department coach can identify some strengths


and weaknesses of the company. However, this drawback can be overcome
and repaired. Principles of organization and administrative functions play an
important role in creating a robust organizational planning, coordination and
control is essential to coordinate all tasks. An organization must be
established and excellent efficient and effective decision-making and
planning, and this is the main principle in the management of an
organization. Through the Industrial Training, it is clear that the training
objectives have been achieved during the training conducted for 20 weeks.
Therefore, it can be concluded that all the exposure that has been given to
the trainees during training is very useful and should be exploited in the
future. Such training also can and will produce graduates who are
knowledgeable and a great personality.

Вам также может понравиться