Django-1: Learn Django Tutorial Getting Started
Django-1: Learn Django Tutorial Getting Started - Outline
- 1.1: Django Web Framework (Python)
- 1.2: Where did it come from?
- 1.3: Philosophies of Django
- 1.4: Advantages of Django
- 1.5: What else Django Provide?
1.1. Django Web Framework (Python)
Django is a free and open-source and fully featured server-side web framework written in Python. It is maintained by the Django Software Foundation (DSF), an independent organization established in the US as a non-profit.
Django's primary goal is to ease the creation of complex, database-driven websites. The framework emphasizes reusability and "pluggability" of components, less code, low coupling, rapid development, and the principle of don't repeat yourself. Python is used throughout, even for settings, files, and data models. Django also provides an optional administrative create, read, update and delete interface that is generated dynamically through introspection and configured via admin models.
Django provides built-in features for everything including Django Admin Interface, default database – SQLlite3, etc. When you’re building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc. Django gives you ready-made components to use and that too for rapid development.
1.2. Where did it come from?
Django was initially developed between 2003 and 2005 by a web team who were responsible for creating and maintaining newspaper websites. After creating a number of sites, the team began to factor out and reuse lots of common code and design patterns. This common code evolved into a generic web development framework, which was open-sourced as the "Django" project in July 2005.
In June 2008, it was announced that a newly formed Django Software Foundation (DSF) would maintain Django in the future.
1.3. Philosophies of Django
- 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. Django was designed with the intention to make a framework which takes less time to build web application.
- Clean Design: Django strictly maintains a clean design throughout its own code and makes it easy to follow best web-development practices.
- Secure: Django takes security seriously and helps developers to avoid many common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery etc. Its user authentication system provides a secure way to manage user accounts and passwords.
- Scalable: Django is scalable in nature and has ability to quickly and flexibly switch from small to large scale application project.
- Fully loaded: Django includes various helping task modules and libraries which can be used to handle common Web development tasks. Django takes care of user authentication, content administration, site maps, RSS feeds etc.
- Versatile: Django is versatile in nature which allows it to build applications for different-different domains. Now a days, Companies are using Django to build various types of applications like: content management systems, social networks sites or scientific computing platforms etc.
- Open Source: Django is an open source web application framework. It is publicly available without cost. It can be downloaded with source code from the public repository. Open source reduces the total cost of the application development.
- Supported Community: Django is an one of the most popular web framework. It has widely supportive community and channels to share and connect.
1.4. Advantages of Django
- Object-Relational Mapping (ORM): 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 NoSQL database through Django-nonrel fork. For now, the only NoSQL databases supported are MongoDB and google app engine.
- Multilingual/Internationalization: Django supports multilingual websites through its built-in internationalization system. So you can develop your website, which would support multiple languages.
- Framework: 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.
- Web Server: a lightweight and standalone web server for development and testing
- Form Serialization & Validation System: a form serialization and validation system that can translate between HTML forms and values suitable for storage in the database
- Template System: a template system that utilizes the concept of inheritance borrowed from object-oriented programming
- Caching Framework: a caching framework that can use any of several cache methods
- Middleware: support for middleware classes that can intervene at various stages of request processing and carry out custom functions
- Dispatcher System: an internal dispatcher system that allows components of an application to communicate events to each other via pre-defined signals
- Serialization: a serialization system that can produce and read XML and/or JSON representations of Django model instances
- Test Framework: an interface to Python's built-in unit test framework
- Django Rest Framework(DRF): to create RESTFul APIs using the Django Rest Framework(DRF), an application used for rapidly building RESTful APIs based on Django models.
1.5. What else Django Provide?
Few things that Django include:
- Forms: HTML Forms are used to collect user data for processing on the server. Django simplifies form creation, validation, and processing.
- User authentication and permissions: Django includes a robust user authentication and permission system that has been built with security in mind.
- Caching: Creating content dynamically is much more computationally intensive (and slow) than serving static content. Django provides flexible caching so that you can store all or part of a rendered page so that it doesn't get re-rendered except when necessary.
- Administration site: The Django administration site is included by default when you create an app using the basic skeleton. It makes it trivially easy to provide an admin page for site administrators to create, edit, and view any data models in your site.
- Serializing data: Django makes it easy to serialize and serve your data as XML or JSON. This can be useful when creating a web service (a website that purely serves data to be consumed by other applications or sites, and doesn't display anything itself), or when creating a website in which the client-side code handles all the rendering of data.