html5-img
1 / 36

Django Tutorial | Django Web Development With Python | Django Training and Certification | Edureka

( Python Django Training - https://www.edureka.co/python-django ) <br>This Edureka u201cDjango Tutorial" introduces you to django along with a practical to create web application using python web framework. This video helps you to learn following topics: <br><br>1. Why Django framework? <br>2. What is Django? <br>3. Architecture: MVC-MVT Pattern <br>4. Hands On: Getting started with Django <br>5. Building blocks of Django <br>6. Project: A web application

EdurekaIN
Download Presentation

Django Tutorial | Django Web Development With Python | Django Training and Certification | Edureka

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  2. Agenda 1 Why Django framework? 2 What is Django? 3 Architecture: MVC-MVT Pattern 4 Hands On: Get Started With Django 5 Building Blocks of Django 6 Project: A Web Application Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  3. Why Django Framework? First, let’s understand how Django came into existence Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  4. Why Django Framework? ❑ Django is a Python web framework ❑ A framework provides a structure and common methods to make the life of a web application developer much easier for building flexible, scalable and maintainable web applications Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  5. Why Django Framework? ➢ A Python web framework is a code library that provide tools and libraries to simplify common web development operations. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  6. What is Django? Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  7. What is Django? Django is a high-level and has a MVC- MVT styled architecture. Django web framework is written on quick and powerful Python language. Django has a open-source collection of libraries for building a fully functioning web application. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  8. Features of Django FA S T F U L LY L O A D E D S EC U R E S C A L A B L E Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  9. Django MVC-MVT Pattern Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  10. Django MVC-MVT Pattern ➢ MVC is slightly different from MVT as Django itself takes care of the Controller part. ➢ It leaves the template which is a HTML file mixed with Django Template Language (DTL). Request View Model View Template Controller Model MVT MVC Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  11. Model View Controller 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. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  12. Hands on Now, let’s create a basic Web App Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  13. Installation Go to the link: 1 https://www.djangoproject. com/download/ Install the latest version of Django 2 Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  14. Create a Project 1 Open the terminal and navigate to the folder where the project is to be created. $ django-admin startprojectfirstproject 2 This will create a "myproject" folder with the following structure: Firstproject/ manage.py firstproject/ __init__.py settings.py urls.py wsgi.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  15. Project Structure firstproject/ firstproject __init__.py “firstproject” folder is just your project container or directory. You can rename it to anything you like. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  16. Project Structure firstproject/ firstproject __init__.py This folder is the actual python package of your project which contains some default files. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  17. Project Structure firstproject/ firstproject __init__.py It is an empty file that tells python that this folder should be treated as package. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  18. Project Structure firstproject/ firstproject __init__.py This contains the settings or the configurations of the project. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  19. Project Structure firstproject/ firstproject __init__.py This file contains all the links of your project and the function to call. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  20. Project Structure firstproject/ firstproject __init__.py It is an entry point for WSGI-compatible web services to serve your project. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  21. Project Structure firstproject/ firstproject __init__.py It is a command line utility that lets you interact with the Django project. settings.py urls.py wsgi.py manage.py Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  22. Your First Web App Congratulations! We have successful created a basic Web App. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  23. Components of Django Now, let’s understand the components/ building blocks of Django Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  24. Building Blocks of Django ORM ORM stands for Object-relational Mapper. Define your data models. You get a rich, dynamic database-access API for free but you can still write SQL if needed. URLs and Views Templates Forms from django.db import models Authentication Class employees(models.Model): firstname = models.CharField(max_length=10) Lastname = models.CharField(max_length=10) Admin def _str_(self): return self.firstname Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  25. Building Blocks of Django ORM Like a table of contents for your app, it contains a simple mapping between URL patterns and your views. URLs and Views Templates from django.conf.urls import url Forms from . import views URL Authentication urlpatterns = [ url(r'^$', views.index, name='index'), ] Admin from Django.shortcuts import render def index(request): return HttpResponse (<h2> Hey! Welcome to Django tutorial</h2>) Internationalization Mapping views and URL Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  26. Building Blocks of Django ORM URLs and Views Templates are designed to feel comfortable and for those who work with HTML, like designers and Templates front-end developers. Forms Authentication TEMPLATE_DIRS = ( '<workspace>/django_project/templates/', ) Admin Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  27. Building Blocks of Django ORM Django provides a powerful form library that handles rendering forms as HTML, validating user-submitted data, and converting that data to native Python types. URLs and Views Templates Forms Authentication Admin Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  28. Building Blocks of Django ORM It handles user accounts, groups, permissions and URLs and Views cookie-based user sessions. Templates Forms from django.contrib.auth.decorators import login_required from django.shortcuts import render Authentication @login_required def my_protected_view(request): return render(request, 'protected.html', {'current_user': request.user}) Admin Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  29. Building Blocks of Django ORM It is the most powerful part that reads metadata in your models to provide a powerful and production-ready interface that can be used to manage content on your site. URLs and Views Templates Forms Authentication Admin Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  30. Building Blocks of Django ORM URLs and Views Templates Django offers full support for translating text into Forms different languages, plus locale-specific Authentication formatting of dates, times, numbers and time Admin zones. Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  31. Building Blocks of Django ORM Django provides multiple protections against: URLs and Views Templates ✓ Clickjacking Forms ✓ Cross-site scripting Authentication ✓ Cross Site Request Forgery (CSRF) ✓ SQL injection Admin ✓ Remote code execution Internationalization Security Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  32. Project Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  33. Session In A Minute Django Framework What is Django Architecture Components Project Hands On Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  34. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

More Related