...

Open source softwares - Django

Back to Course

Lesson Description


Lession - #969 Django-Intro


What is Django?

Django is a Python framework that makes it more easier to make sites utilizing Python.

Django deals with the troublesome stuff so you can focus on building your web applications.

Django underscores reusability of parts, additionally refereed to as DRY (Don't Repeat Yourself>
, and comes with ready-to-utilize highlights like login system, information base association and CRUD operations (Create Read Update Delete>
.

How Does Django Works?

Django follows the MVT configuration design (Model View Template>
.

  • Model - The information you need to introduce, as a rule information from a database.
  • View - A request handler that profits the significant layout and content - in light of the request from the client.
  • Format - A text file (like a HTML document>
    containing the design of the web page, with logic on the best way to show the information.

    Model

    The model gives information from the database.

    In Django, the information is conveyed as an Object Relational Mapping (ORM>
    , which is a procedure intended to make it more easier to work with data sets.

    The most well-known method for extract information from a data set is SQL. One issue with SQL is that you must have a very decent comprehension of the information base construction to have the option to work with it.

    Django, with ORM, makes it simpler to communicate with the database, without composing complex SQL statements.

    The models are normally situated in a document called models.py.

    View

    A view is a function or method that takes http request as contentions, imports the relevant model(s>
    , and finds out what information to send to the template, and returns the final result.

    The views are generally situated in a file called views.py.

    Template

    A template is a record where you depict how the result should be addressed.

    templates are frequently .html files, with HTML code portraying the design of a page, however it can likewise be in other document formats to present other results, but we will concentrate on .html files.

    Django utilizes standard HTML to portray the format, however utilizes Django tags to add logic:

    <h1>My Homepage</h1>
    
    <p>My name is {{ firstname }}.</p>


    URLs

    Django likewise give a method for exploring around the various pages in a site.

    At the point when a client demands a URL, Django concludes which view it will send it to.

    This is done in a file called urls.py.

    Django History

    Django was designed by Lawrence Journal-World in 2003, to fulfill the short deadlines in the newspaper and simultaneously satisfying the needs of experienced web developers.

    Beginning release to the public was in July 2005.

    Most recent version of Django is 4.0.3 (March 2022>
    .