77raina·2020년 5월 7일

What is Django?

It is a python web framework, which does not allow us to customize that much and mostly inherited. Templates are given but are not actually needed but rather models, views, and control(logics) are needed! What we're going to make is endpoint, api, data offering api service.

Backend developer's Requirements

  1. API Design

How to start project?

$ conda create -n test03 python=3.8
$ conda env list 

It shows a list of virtual environments

$ conda activate test03
$ pip freeze

To see the packages installed in the virtual environment

$ pip install django
$ mkdir practice 

It creates a practice app

$ django-admin startproject test03
$ tree

Below is the directory tree when we start project test03

└── test03
    └── is the highest directory of the project. is an asynchronous server gate interface. is used to connect web server and django framework is for server routing.

Quick Summary for Django Cycle Flow

  1. User as a client requests to see the web application.
  2. Requesting a specific address and it breaks down into small pieces, which is called parcing.
  3. Broken down addresses are distributed in view depending on their roles.
  4. has a written code by us for developing each web application's functionality
  5. Then it's delivered to template.
  6. User receives a response and client is able to see in the browser.
$ python runserver
$ python startapp account
├── account
│   ├──
│   ├──
│   ├──
│   ├── migrations
│   │   └──
│   ├──
│   ├──
│   └──
├── db.sqlite3
└── test03
    ├── __pycache__
    │   ├── __init__.cpython-38.pyc
    │   ├── settings.cpython-38.pyc
    │   ├── urls.cpython-38.pyc
    │   └── wsgi.cpython-38.pyc

App vs. Project?

App is a web application for web log system, publicly recorded database, or opinion polls in a small scale, whereas project is a collection of certain website config and apps. Project can contain multiples of apps. An app can be in multiples of projects.

$ python makemigrations account 

It'll create migrations for 'account'

Migration: Intermediate process to check the history of change in If there's an mistake found after the database modification, we can't go edit the database, but should modify in It's basically acting like a git.

$ python sqlmigrate account 0001 

It'll show sql queries

$ python migrate account 0001
Backend Developer

0개의 댓글