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

2023-12-13 06:01:28
(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

文件上传服务器,但是还是找不到静态文件。这是由于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

文章来源:https://blog.csdn.net/xiaodaimu00/article/details/134947172
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。