“GET /static/plugins/bootstrap-3.4.1/css/bootstrap.css HTTP/1.1“ 302 0

(bom) [root@VM-16-2-centos Mysite]# python manage.py runserver 0.0.0.0:9999
Performing system checks...

System check identified no issues (0 silenced).
December 12, 2023 - 04:09:41
Django version 2.2, using settings 'Mysite.settings'
Starting development server at http://0.0.0.0:9999/
Quit the server with CONTROL-C.
[12/Dec/2023 04:09:45] "GET /login/ HTTP/1.1" 200 2046
[12/Dec/2023 04:09:46] "GET /static/plugins/bootstrap-3.4.1/css/bootstrap.css HTTP/1.1" 302 0

将django上传到服务器,然后用manage.py启动,找不到静态文件。

需要修改setting

“GET /static/plugins/bootstrap-3.4.1/css/bootstrap.css HTTP/1.1“ 302 0_第1张图片

“GET /static/plugins/bootstrap-3.4.1/css/bootstrap.css HTTP/1.1“ 302 0_第2张图片

文件上传服务器,但是还是找不到静态文件。这是由于debug模式关闭后,django就不会接管你的静态文件处理了,会人为你已经在web服务器,如nginx中处理好了,如果你想在这个模式下运用你的服务,你可以使用

 python manage.py runserver 0.0.0.0:9999 --insecure

就可以正常加载静态文件了

(bom) [root@VM-16-2-centos Mysite]# python manage.py runserver 0.0.0.0:9999 --insecure
Performing system checks...

System check identified no issues (0 silenced).
December 12, 2023 - 05:10:31
Django version 2.2, using settings 'Mysite.settings'
Starting development server at http://0.0.0.0:9999/
Quit the server with CONTROL-C.
[12/Dec/2023 05:10:39] "GET /login/ HTTP/1.1" 200 2046
[12/Dec/2023 05:10:40] "GET /image/code/ HTTP/1.1" 200 1890
[12/Dec/2023 05:11:35] "POST /login/ HTTP/1.1" 200 2114
[12/Dec/2023 05:11:35] "GET /image/code/ HTTP/1.1" 200 1695

你可能感兴趣的:(错误处理,Django框架,css,bootstrap,http)