Run the Django development server

Django includes a lightweight web server, and can run code quickly, and does not need to spend extra time configuring product services. When running the Django development server, it will constantly check the changes in the code, so that you don't have to manually reload it after the code is changed, but if you add a new file, you need to restart it manually, otherwise Django will not recognize it.

Run the Django development server:

Enter the following command in the project folder to start the development server:

python manage.py runserver

The corresponding results are as follows:

System check identified no issues (0 silenced).
January 05, 2021 - 19:51:41
Django version 3.1.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

After that, run http://127.0.0.1:8000/ in the browser, and then the successful project operation page will be displayed, as follows:

Insert picture description here
  The above chart name, Django is running, when you view the console, you will see the GET request executed by the browser, as shown in the following figure:

[05/Jan/2021 20:30:04] "GET / HTTP/1.1" 200 16351

Precautions:

  1. Start Django server will occupy port 8000 on your computer, if you have a computer running a similar cool dog software, then you will not run successfully, the need to cool the dog software withdraw from the background

  2. The server is only suitable for development environments, not product applications.

Guess you like

Origin blog.csdn.net/Erudite_x/article/details/112252822