• DJANGO MODELS AND DATABASE
  • What is Model
  • CREATE YOUR FIRST MODEL
  • Introduction to Django Reja




    Download 1,28 Mb.
    bet3/6
    Sana19.11.2023
    Hajmi1,28 Mb.
    #101246
    1   2   3   4   5   6
    Bog'liq
    django 1
    Жураев А, elektr1-ma\'ruza, Lagranj interpolyatsion formulasi. Nyutonning tengmas oraliqlar (1), Yeshniyazov Erkin Dasturlash, Avtomatik qayta ishga tushirish - Vikipediya., Menejment-va-strategik-rejalashtirish, 1-Laboratoriya ishi, Lecture 2, axborot xavfsizligi, amaliyot kt, 2- mavzu O‘quv amaliyot mashg‘ulotining o‘qitish texnologiyasi, 56-59, Mustaqil ta’lim uchun mavzular Sharq mutafakkirlarining pedagog, markaziy-osiyo-davlatlari-tashqi-siyosatida-mintaqaviy-hamkorlik

    To see all the files and subfolders of django project, we can use tree command to view the tree structure of the application. This is a utility command, if it is not present, can be downloaded via apt-get install tree command.

    Running the Django Project

    • Django project has a built-in development server which is used to run application instantly without any external web server. It means we don't need of Apache or another web server to run the application in development mode.
    • To run the application, we can use the following command.
    • $ python3 manage.py runserver

    Look server has started and can be accessed at localhost with port 8000. Let's access it using the browser, it looks like the below.

    DJANGO MODELS AND DATABASE

    Agenda

    • Create First Model
    • Model Fields
    • Databases
    • 01
    • 02
    • 03
    • 04

    What is Model?

    • A model is the single, definitive source of information about your data.
    • It contains the essential fields and behaviors of the data
    • you’re storing
    • Generally, each model maps to a single database table.
    • Each model is a Python class that subclasses django.db.models.Model.
    • Each attribute of the model represents a database field.

    CREATE YOUR FIRST MODEL

    • from django.db import models
    • class Person(models.Model):
    • first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30)

    Download 1,28 Mb.
    1   2   3   4   5   6




    Download 1,28 Mb.