Location>code7788 >text

Reading Notes for Django 5 By Example: p679-p765

Popularity:155 ℃/2024-11-20 17:49:15

Django 5 By Example Study Day 10, p679-p765 Summary, 87 pages total.

I. Technical summary

The book demonstrates the application of channel and asynchronous programming in Django through the function of chat software, I am not very familiar with this piece, do not comment.

(Deployment)

services:
  db:
    image: postgres:16.2
    restart: always
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

  cache:
    image: redis:7.2.4
    restart: always
    volumes:
      - ./data/cache:/data

  web:
    build: .
    command: ["./", "db:5432", "--",
              "uwsgi", "--ini", "/code/config/uwsgi/"]
    restart: always
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    environment:
      - DJANGO_SETTINGS_MODULE=
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    depends_on:
      - db
      - cache
  ...(Other content omitted)

After reading the author's write-up, here's a little more to say:

(1) Include the build command in it, which I think is a bad way to write. Because the number of service restarts is much more than the number of builds, and there is no need to build every time.

(2) the service is named db, I think this is a bad way to write. Because the meaning of db is not clear, you can refer to "MySQL, Oracle, MongoDB, Redis", etc., the use of the Postgresql database, then directly named with postgresql better.

(3) The database is named postgres, which I think is a bad way to write. Because the meaning is not clear.

II. English summary (vocabulary: 3)

(1)engage: en-("in") + gage("a pledge, commitment, or security,assurances,promise")。

p679, In this chapter, you will develop a chat server for students using Django Channels, enabling students to engage in real-time messaging within course chat rooms. engageThere are more uses of,Here's what it means.:to get involved in sth, to take part in sth.

p685, ASGI is the emerging Python standard for asynchronous web servers and applications.

(1)emerge: e-("out, from") + mergere("to dip ")

vi. to rise from, to rise out of.

(2) emerging

adj. starting to exist.

p685, WebSockets provide full-duplex communication by establishing a persistent, open, bidirectional Transmission Control Protocol (TCP) connection between servers and clients.

(1) duplex: duo-("two") + plex("to plait (put... braid)")

adj. composed of two parts. n. house or other building so divided that it forms two dwelling places.

The meaning of full-duplex communication above is (full duplex communication).

III. Other

chapter 16 brief comment: this chapter covers the content of the previous chapters, if you are not familiar with the channel in Django, I feel that it is not a good understanding. Personally, I find it a bit confusing to read down.

chapter 17 brief comment: chapter 17 will be deployed, now popular use of Docker deployment, the book used in this way, can be said to keep pace with the times, in general read down or relatively smooth, after all, the content is not considered to be the development of, in short, summed up is to practice more. The only drawback is that the author is not written in a standardized way (introduced above, and will not be expanded here).

IV. References

1. Programming

(1) Antonio Melé,《Django 5 By Example》:/subject/37007362/

2. English

(1) Etymology Dictionary:

(2) Cambridge Dictionary:

Welcome to search and follow: programmers (a_codists)