Django Framework Overview and Installation Guide

django n.w
1 / 14
Embed
Share

"Learn about Django, an open-source Python framework, from its history to basic concepts like the Model-View-Template design pattern. Discover how Django works, how to install it, set it up for the first time, and navigate its file directory structure. Get started on your Django journey today!"

  • Django
  • Python
  • Web Development
  • Framework

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Django Shabib Ahmed and Dylan Burns

  2. A Brief History Devlopment started in 2003 by Adrian Holovaty and Simon Willison The first version was released in 2005 Named after the guitarist Django Reinhardt In 2008 Django Software Foundation (DSF) was formed to maintain Django Was made from a practical need to match the fast pace of a newsroom

  3. Django Overview Open Source Python Based Framework Maintained by Django Software Foundation

  4. Django Basics Django Follows a Model View Template design pattern Model The data you want to use View A request handler that return a template and content based on user request Template A HTML file containing the structure of the webpage

  5. How Django Works The Django Server receives a URL request 1. Urls.py checks the URL and then calls the matching view 2. The view in view.py checks the models for the correct information 3. The view then sends the correct information to a template 4. The template then inputs the data needed into the correct Django tags within itself 5. The completed template is then sent to the user 6.

  6. Installing Django Because Django is based in Python you need to install Python first Once Python is installed, use the command: python -m pip install Django Because Django is a python package it's possible to use VENV which creates a virtual environment for python, keeping the Django installation in a more isolated environment

  7. First Time Django Setup To start with Django it's necessary to use the command: django-admin startproject XXX XXX: The name of your project This will setup your directory with all the necessary files

  8. Starting Django File Directory XXX/ : Outer Root Directory Manage.py : Command line utility to interact with the project XXX/ : Inner Root Directory is the Python package _init_.py : Empty file that that tells Python that is a Python package Settings.py : Configuration settings for the Project Urls.py : URL Declarations for the Project Asgi.py : File for ASGI compatibility Wsgi.py : File for WSGI compatibility

  9. Development Server From the outer directory run the command: python manage.py runserver This will start a development server that you can quickly access to see your website By default, this will that the server on port 8000 and the default IP address If you want to use a different port add your desired port to the end of the command python manage.py runserver 420 If you want to use a different IP add your desired IP to the end of the command with the port python manage.py runserver 0.0.0.0:8000 You don't need to restart the server to see changes you've made in code

  10. Creating Your First App and View To make your first app use the following command in the inner directory: py manage.py startapp xxx This will create a new directory called xxx in your project which will contain the following files Admin.py Apps.py Models.py Tests.py View.py

  11. Templates To make a template create a templates folder and add a .html file Returns html content to the client Can use Django's template language to make changes to the html Templates are rendered server side rather than client side

  12. Code Example

  13. Questions?

  14. Sources https://www.w3schools.com/django/index.php https://www.djangoproject.com/

More Related Content