静态文件

背景:用drf但是通过浏览器访问时,缺少静态文件。

正式部署django项目时,需要

在settings.py文件中添加STATIC_ROOT

STATIC_ROOT="./static/"

运行python .\manage.py collectstatic命令,否则nginx无法找到静态文件

PS E:\Programming\python\webapp\api> python .\manage.py collectstatic

163 static files copied to 'E:\Programming\python\webapp\api\static'.