简体   繁体   English

Pycharm无法加载找到我的静态文件

[英]Pycharm does not load find my static files

Pycharm cannot find my css files. Pycharm找不到我的CSS文件。 In the screenshot, the settings.py is shown, along with the directory where the .css is located and the terminal giving back a 404. Can someone kindly point to me where is the problem ? 在屏幕截图中,显示了settings.py以及.css所在的目录和终端机返回的404。有人可以指出我的问题在哪里吗?

在此处输入图片说明

Use STATICFILES_DIRS instead of STATIC_ROOT , like this: 使用STATICFILES_DIRS而不是STATIC_ROOT ,如下所示:

STATICFILES_DIRS = os.path.join(BASE_DIR, 'static')

Here's a SO explanation of the difference between STATICFILES_DIRS and STATIC_ROOT (scroll down to the section that starts with: "...Development STATIC_ROOT is useless during development, it's only required for deployment.") 这是STATICFILES_DIRS和STATIC_ROOT之间差异的SO解释 (向下滚动到以...开头的部分:“ ...开发STATIC_ROOT在开发过程中无用,仅在部署时需要。”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM